Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New linking experience. #17368

Draft
wants to merge 205 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
da30dbd
Feature (link): Update UI of the small Link panel
filipsobol Oct 15, 2024
1b3d161
Optimize SVG
filipsobol Oct 15, 2024
56df972
Make the existing tests pass
filipsobol Oct 15, 2024
7e317cc
Rename `left` and `right` o `leftSlot` and `rightSlot`
filipsobol Oct 16, 2024
66c2305
Remove unfinished code for displaying errors for the "Displayed text"…
filipsobol Oct 16, 2024
bc9cb31
Add tests covering `leftSlot` and `rightSlot`
filipsobol Oct 16, 2024
6141b0f
Make the "Insert" button slightly wider, as per the design
filipsobol Oct 16, 2024
65b7116
Add missing code comments
filipsobol Oct 16, 2024
35b6de5
Update based on feedback
filipsobol Oct 16, 2024
15697ab
Revert change in `resetFormStatus`
filipsobol Oct 16, 2024
bacbfa7
Update checked class name
filipsobol Oct 16, 2024
6888409
Fix test
filipsobol Oct 16, 2024
164a78b
Use form view is link UI footer
filipsobol Oct 17, 2024
d8cfa76
Add missing dev dependency
filipsobol Oct 17, 2024
a82849f
Fix dependency version
filipsobol Oct 17, 2024
6a17c14
Replaced LinkActionsView with ToolbarView.
niegowski Oct 17, 2024
a5054d0
Updated theme css.
niegowski Oct 17, 2024
9eae802
Add missing items to the `contexts.json`
filipsobol Oct 18, 2024
926d12d
Replaced bookmark actions view with bookmark toolbar.
niegowski Oct 18, 2024
b2b8382
Added missing theme changes.
niegowski Oct 18, 2024
2fd1097
Merge branch 'refs/heads/ck/epic/17230-linking-experience' into ck/17…
niegowski Oct 18, 2024
8801976
Apply suggestions from code review
filipsobol Oct 21, 2024
e5c3ba9
Update name of the variable
filipsobol Oct 21, 2024
fc52947
Merge pull request #17265 from ckeditor/update-small-link-panel
filipsobol Oct 21, 2024
21284d2
Merge branch 'refs/heads/ck/epic/17230-linking-experience' into ck/17…
niegowski Oct 21, 2024
c06c42d
Simplified handling of scroll to bookmark.
niegowski Oct 21, 2024
4273091
Feature (link): Add `Advanced` view UI
filipsobol Oct 21, 2024
bdb872b
Added tests for custom positions for widget toolbar.
niegowski Oct 21, 2024
3600a2d
Updated tests for BookmarkUI.
niegowski Oct 21, 2024
8c42492
Added tests.
niegowski Oct 22, 2024
3e3f343
Adding tests.
niegowski Oct 22, 2024
0f1c3c1
Feature (link): Properly handle opening and closing of the Advanced p…
filipsobol Oct 22, 2024
ad799cf
Adding tests.
niegowski Oct 22, 2024
6a72381
Destroy the Advanced view together with the rest of views and add mis…
filipsobol Oct 22, 2024
d714014
Added bookmarks view panel.
pszczesniak Oct 23, 2024
d96fd2c
Show message when no bookmarks available.
pszczesniak Oct 23, 2024
1d05aa5
Do not auto-update decorators
filipsobol Oct 23, 2024
42b2795
Include link toolbar in toolbars cycling.
niegowski Oct 23, 2024
2ec5eae
Style the empty information when no bookmarks available.
pszczesniak Oct 24, 2024
7abf7b8
Removed commented code.
pszczesniak Oct 24, 2024
23109ae
Code refactor.
niegowski Oct 24, 2024
7b3f6cb
Code refactor.
pszczesniak Oct 24, 2024
bcf7e7e
Fix tests
filipsobol Oct 24, 2024
edd58fd
Fix the widths of input fields.
pszczesniak Oct 25, 2024
cec3747
Added comments to explain how to manage the focus.
pszczesniak Oct 25, 2024
1677b46
Moved bookmark icons to the core package.
pszczesniak Oct 24, 2024
ebf370c
Added bookmark icon to the bookmark list item.
pszczesniak Oct 25, 2024
f86ac7b
Fix code coverage
filipsobol Oct 25, 2024
d286299
Add translations
filipsobol Oct 25, 2024
55faede
Remove comment
filipsobol Oct 25, 2024
7941da9
Remove comment
filipsobol Oct 25, 2024
c9b6418
Fix comment
filipsobol Oct 25, 2024
b70797f
Fix comments
filipsobol Oct 25, 2024
77ddc30
Added tests to 'getAllBookmarkNames' method.
pszczesniak Oct 25, 2024
aa52358
Code refactor.
niegowski Oct 25, 2024
b3a8095
Added tests.
pszczesniak Oct 25, 2024
02788fb
Move common translations to the `core` package
filipsobol Oct 25, 2024
6b2a7ed
Remove the `showAdvanced` event and use generic `execute` event instead
filipsobol Oct 25, 2024
2572f59
Use `div` instead of `form`
filipsobol Oct 25, 2024
1910f40
Add dedicated advanced view class
filipsobol Oct 25, 2024
8eef5f6
Added event type.
pszczesniak Oct 28, 2024
f241f43
Change the order of removing views and update the isUIVisible getter.
pszczesniak Oct 28, 2024
f54ba36
Added tests for LinkUI class.
pszczesniak Oct 28, 2024
2f2b5d1
Fix tests
filipsobol Oct 28, 2024
00dd241
Feedback fixes
filipsobol Oct 28, 2024
40a9239
Reuse available method
filipsobol Oct 28, 2024
239f33f
Fix test
filipsobol Oct 28, 2024
80fbb3c
Apply suggestions.
filipsobol Oct 28, 2024
2edffb6
Change default values in test
filipsobol Oct 28, 2024
5f1c8e6
Merge pull request #17325 from ckeditor/add-advanced-view-to-link-ui
filipsobol Oct 28, 2024
ac62819
Updated tests.
niegowski Oct 28, 2024
512bd73
Merge branch 'refs/heads/ck/epic/17230-linking-experience' into ck/17…
niegowski Oct 28, 2024
1a3c069
Other (link): Hide the settings button if there are no manual decorat…
filipsobol Oct 28, 2024
6eed8f4
Added more tests.
pszczesniak Oct 28, 2024
2dd03ad
Merge branch 'ck/epic/17230-linking-experience' into ck/17230-bookmar…
pszczesniak Oct 28, 2024
ea8ec24
Styled bookmarks panel.
pszczesniak Oct 28, 2024
0d3ba80
Apply suggestions from code review
filipsobol Oct 29, 2024
b0eaeab
Apply suggestions from code review.
pszczesniak Oct 29, 2024
b114b7c
Merge pull request #17347 from ckeditor/hide-settings-button-without-…
filipsobol Oct 29, 2024
6c5857f
Merge remote-tracking branch 'origin/master' into ck/epic/17230-linki…
filipsobol Oct 29, 2024
17e1a9c
Merge branch 'refs/heads/ck/epic/17230-linking-experience' into ck/17…
niegowski Oct 29, 2024
da427fa
Code refactor.
niegowski Oct 29, 2024
7b756cb
Code refactor.
niegowski Oct 29, 2024
b42a230
Code refactor.
niegowski Oct 29, 2024
8094374
Code refactor.
niegowski Oct 29, 2024
77aa258
Code refactor.
niegowski Oct 29, 2024
8ab51c9
Code refactor.
niegowski Oct 29, 2024
b603e81
Code refactor.
niegowski Oct 29, 2024
2127878
Added missing context.
niegowski Oct 29, 2024
327a8ca
Fixed tests.
niegowski Oct 29, 2024
a6e5dd6
Merge pull request #17340 from ckeditor/ck/17230-bookmarks-view
niegowski Oct 29, 2024
10ea525
Merge branch 'refs/heads/ck/epic/17230-linking-experience' into ck/17…
niegowski Oct 29, 2024
9bba842
Fix imports.
niegowski Oct 29, 2024
77f122e
Feature (link): Add basic support for "Displayed text" input
filipsobol Oct 29, 2024
8681829
Added tests.
niegowski Oct 29, 2024
d2a706e
Added tests.
niegowski Oct 29, 2024
7312f71
Fixed dependencies.
niegowski Oct 30, 2024
3507e74
Added bookmark icon on link preview button.
niegowski Oct 30, 2024
85ca0f5
Update
filipsobol Oct 30, 2024
ab4e356
Updated tests.
niegowski Oct 30, 2024
4eef8e6
Code cleanup before review.
niegowski Oct 30, 2024
bcc09dd
Update
filipsobol Oct 30, 2024
9e577ed
Other (link): Rename the `cancel` event to `back` in LinkAdvancedView.
filipsobol Oct 30, 2024
4a59575
Renamed internal method.
niegowski Oct 30, 2024
c698b4a
Docs fixes.
niegowski Oct 30, 2024
0bec17a
Fix tests
filipsobol Oct 30, 2024
4a23fde
Updated styles.
niegowski Oct 30, 2024
680aa2f
Fix docs.
niegowski Oct 30, 2024
1928ac6
Merge pull request #17364 from ckeditor/rename-the-cancel-event-to-back
filipsobol Oct 31, 2024
32baeb8
Updated bookmark icons.
niegowski Oct 31, 2024
235023b
Added missing icons.
niegowski Oct 31, 2024
5104e6b
Updated optimized icon.
niegowski Oct 31, 2024
1f1e736
Removed redundant css class.
niegowski Oct 31, 2024
610d412
Changed bookmark icon sizes to be relative to the main font size.
pszczesniak Oct 31, 2024
71714fd
Extended condition while updating the link content.
pszczesniak Oct 31, 2024
d53fa3d
Merge pull request #17283 from ckeditor/ck/17230-link-toolbar
niegowski Oct 31, 2024
e62903a
Updated behaviour of showing and extracting the displayed text.
pszczesniak Nov 14, 2024
9ebe493
Code refactor.
pszczesniak Nov 14, 2024
07485d8
Added missing test.
pszczesniak Nov 14, 2024
526b3bf
Tests update.
pszczesniak Nov 14, 2024
9311634
Code refactor.
pszczesniak Nov 14, 2024
cc34e87
Code refactor. [skip ci]
pszczesniak Nov 14, 2024
6da0d24
Merge branch 'ck/epic/17230-linking-experience' into add-displayed-text
pszczesniak Nov 14, 2024
25e2a59
Fixed condition for 'canHaveDisplayedText' property depend on selection.
pszczesniak Nov 18, 2024
c1b5155
Code refactoring WiP.
niegowski Nov 22, 2024
4c34563
Fixed multiple replacements and restoring the document selection.
niegowski Nov 23, 2024
ec8376d
Updated link marker handling on link text replacement.
niegowski Nov 25, 2024
df04f48
Collecting selected/link text for displayed link text UI.
niegowski Nov 25, 2024
aae856a
Updated selected link text extraction.
niegowski Nov 25, 2024
57f0460
Updated tests.
niegowski Nov 25, 2024
5396a03
Merge remote-tracking branch 'origin' into ck/epic/17230-linking-expe…
Mati365 Nov 26, 2024
25b5301
Fix deps after merge.
Mati365 Nov 26, 2024
f440fc0
Merge branch 'ck/epic/17230-linking-experience' into add-displayed-text
Mati365 Nov 26, 2024
7074b35
Selection should not be modified after link url change.
niegowski Nov 26, 2024
6df0890
Link UI should not update in RTC while open.
niegowski Nov 26, 2024
46f27d3
Removed obsolete tests.
niegowski Nov 26, 2024
3e6eecb
Adjusted tests.
niegowski Nov 26, 2024
239203b
Docs: Add a section about linking in the Bookmarks guide.
gorzelinski Nov 26, 2024
e4e3dcd
Docs: minor fixes. [short flow]
godai78 Nov 26, 2024
b671e3c
Merge pull request #17535 from ckeditor/bookmarks-linking-experiance
gorzelinski Nov 26, 2024
6c5524e
Updated LinkUI tests.
niegowski Nov 26, 2024
473d31b
Added tests.
niegowski Nov 26, 2024
e09416f
Added test.
niegowski Nov 26, 2024
1c019da
Updated tests.
niegowski Nov 26, 2024
3b5c516
CSS link refactor.
pszczesniak Nov 26, 2024
1e042ad
Fixed typos. [skip ci]
pszczesniak Nov 26, 2024
f17c9e9
Move link advanced section to separate link properties balloon toolba…
Mati365 Nov 26, 2024
d6e071d
Create properties view on demand.
Mati365 Nov 27, 2024
944ab1e
Merge pull request #17534 from ckeditor/ck/epic/17230-add-standalone-…
Mati365 Nov 27, 2024
224c646
Extend the API docs for linkcommand execute method for 'displayedText…
pszczesniak Nov 27, 2024
0611c72
Merge pull request #17469 from ckeditor/add-displayed-text
pszczesniak Nov 27, 2024
d7f77ba
Merge branch 'ck/epic/17230-linking-experience' into ck/1723-link-css…
pszczesniak Nov 27, 2024
4163dd6
Unify UI of custom image resize balloon.
Mati365 Nov 27, 2024
a7c6cf5
Fix tests.
Mati365 Nov 27, 2024
f61880e
Improve translations, add test for header.
Mati365 Nov 27, 2024
e6b6ece
Unify text alternative form view.
Mati365 Nov 27, 2024
3fa5f9d
Fix tests.
Mati365 Nov 27, 2024
01aec65
Improve focus cycler order.
Mati365 Nov 27, 2024
120d453
Improve focus cycler tracking.
Mati365 Nov 27, 2024
2b648bf
Unify UI of bookmark form view.
Mati365 Nov 27, 2024
53885b5
Increase specificity of link panel for bookmarks.
pszczesniak Nov 27, 2024
3d61733
Update comment.
pszczesniak Nov 27, 2024
93826e8
Move definitions of variables to proper file.
pszczesniak Nov 27, 2024
d009136
Remove unnecessary propety.
pszczesniak Nov 27, 2024
e9f1981
Fix tests.
Mati365 Nov 27, 2024
1266a6b
Inputs and buttons now will be fully responsive based on font size.
pszczesniak Nov 27, 2024
4a631df
Remove unused CSS import.
pszczesniak Nov 28, 2024
df474be
Made more descriptive variables and cleaned the CSS.
pszczesniak Nov 28, 2024
6d9580b
Rename `Update` to `Save` cta in bookmark ui balloon.
Mati365 Nov 28, 2024
212bb85
Rename `Resize` to `Save` cta in resize ui balloon.
Mati365 Nov 28, 2024
46406ca
Docs: Update the Focus tracking guide.
gorzelinski Nov 27, 2024
0d723c2
Aligned CSS.
pszczesniak Nov 28, 2024
be25ffe
Change the label of back button from 'cancel' to 'back'.
pszczesniak Nov 28, 2024
fe1d5fd
Align CSS.
pszczesniak Nov 28, 2024
b475cdc
Merge pull request #17553 from ckeditor/update-link-ui-docs
gorzelinski Nov 28, 2024
14c67e8
Align CSS.
pszczesniak Nov 28, 2024
371523a
Unify input-and-submit CSS class.
pszczesniak Nov 28, 2024
0f4626a
Unify input-and-submit CSS class.
pszczesniak Nov 28, 2024
1f92c39
Unify input-and-submit CSS class.
pszczesniak Nov 28, 2024
75dcc55
Unified form close handling.
niegowski Nov 28, 2024
49f5671
Fix typo.
Mati365 Nov 28, 2024
64c2177
Changed listChildren name to be more descriptive.
pszczesniak Nov 28, 2024
b3214f6
Fix docs.
Mati365 Nov 28, 2024
4a37c7b
Adjust comments.
Mati365 Nov 28, 2024
bbc538e
Fix comments.
Mati365 Nov 28, 2024
4d14626
Merge pull request #17539 from ckeditor/ck/1723-link-css-refactor
niegowski Nov 28, 2024
27b75de
Code review fixes.
niegowski Nov 28, 2024
1d914ec
Code review fixes.
niegowski Nov 28, 2024
c07aae0
Code review fixes.
niegowski Nov 28, 2024
843bdfa
Code review fixes.
niegowski Nov 28, 2024
30da526
Code review fixes.
niegowski Nov 28, 2024
6177ea5
Merge pull request #17549 from ckeditor/ck/epic/17230-linking-experie…
niegowski Nov 28, 2024
f63ab4d
Merge branch 'ck/epic/17230-linking-experience' into ck/epic/17230-im…
niegowski Nov 28, 2024
f9d70ed
Code review fixes.
niegowski Nov 28, 2024
dcd38c5
Code review fixes.
niegowski Nov 28, 2024
9a259e6
Code review fixes.
niegowski Nov 28, 2024
a0dc381
Merge branch 'ck/epic/17230-linking-experience' into ck/epic/17230-li…
niegowski Nov 28, 2024
394bd13
Code review fixes.
niegowski Nov 28, 2024
3f7e01c
Code review fixes.
niegowski Nov 28, 2024
2f9abd5
Code review fixes.
niegowski Nov 28, 2024
91614a2
Code review fixes.
niegowski Nov 28, 2024
75436c5
Code review fixes.
niegowski Nov 28, 2024
b5ce008
Merge pull request #17546 from ckeditor/ck/epic/17230-image-resize-un…
niegowski Nov 28, 2024
eb13a39
Merge branch 'ck/epic/17230-linking-experience' into ck/epic/17230-li…
niegowski Nov 28, 2024
92830e2
Merge pull request #17547 from ckeditor/ck/epic/17230-link-text-alter…
niegowski Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/assets/img/bookmarks-panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion packages/ckeditor5-bookmark/docs/features/bookmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The bookmarks feature allows for adding and managing the bookmarks anchors attac

Use the bookmark toolbar button {@icon @ckeditor/ckeditor5-core/theme/icons/bookmark.svg Add bookmark} in the editor below to see the feature in action. Or use the "Insert" command from the menu bar to add a bookmark. Add a unique name to identify the bookmark (for example, `Rights`).

To use the bookmark as an anchor in the content, add a link {@icon @ckeditor/ckeditor5-link/theme/icons/link.svg Add link} and put the bookmark name as target. In this example it would be `#Rights`. You can change the bookmark's name or remove it by clicking the bookmark icon inside the content. A contextual bookmark toolbar will pop up.
You can change the bookmark's name or remove it by clicking the bookmark icon inside the content. A contextual bookmark toolbar will pop up.

{@snippet features/bookmark}

Expand All @@ -27,12 +27,19 @@ To use the bookmark as an anchor in the content, add a link {@icon @ckeditor/cke
Do not worry about setting a bookmark inside an empty paragraph. The block with the `a` tag will not be rendered in the final content (for example for printing).

The feature converts anchors into bookmarks during the {@link getting-started/setup/getting-and-setting-data#initializing-the-editor-with-data initialization of the editor} or while {@link getting-started/setup/getting-and-setting-data#replacing-the-editor-data-with-setdata replacing the editor data with `setData()`}. The notation based on the `id` attribute in an `a` HTML element without a `href` attribute is converted. Similar notations meet the conditions, too:

* an `a` HTML element with a `name` attribute,
* an `a` HTML element with the same `name` and `id` attributes,
* an `a` HTML element with different `name` and `id` attributes.

By default, all bookmarks created in the editor only have the `id="..."` attribute in the {@link getting-started/setup/getting-and-setting-data#getting-the-editor-data-with-getdata editor data}.

## Integration with the link feature

Bookmarks integrate with {@link features/link links}, providing a smooth linking experience. If you have any bookmarks in your content, you can access the "Bookmarks" panel available during link creation. It will display all bookmarks available in the edited content. Choose one of the anchors from the list and use it as a link target.

{@img assets/img/bookmarks-panel.png 600 The bookmarks panel displayed during link creation}

## Installation

<info-box info>
Expand Down Expand Up @@ -101,6 +108,7 @@ Here are some other CKEditor&nbsp;5 features that you can use similarly to the b
## Common API

The {@link module:bookmark/bookmark~Bookmark} plugin registers the `'bookmark'` UI button component implemented by the {@link module:bookmark/bookmarkui~BookmarkUI bookmark UI feature}, and the following commands:

* the `'insertBookmark'` command implemented by the {@link module:bookmark/insertbookmarkcommand~InsertBookmarkCommand editing feature}.
* the `'updateBookmark'` command implemented by the {@link module:bookmark/updatebookmarkcommand~UpdateBookmarkCommand editing feature}.

Expand Down
5 changes: 2 additions & 3 deletions packages/ckeditor5-bookmark/lang/contexts.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"Bookmark": "The label of the bookmark toolbar button. Also, a bookmark form header.",
"Insert": "The button in the bookmark insert form.",
"Update": "The button in the bookmark update form.",
"Edit bookmark": "Button opening the Bookmark editing balloon.",
"Remove bookmark": "Toolbar button tooltip for bookmark remove button.",
"Bookmark name": "The label of the input in the bookmark insert and update form. Also, the tooltip for the bookmark name in the bookmark preview.",
"Enter the bookmark name without spaces.": "The description of bookmark input in the bookmark insert form.",
"Bookmark must not be empty.": "The error message. Displayed when the bookmark name is empty.",
"Bookmark name cannot contain space characters.": "The error message. Displayed when provided name includes spaces.",
"Bookmark name already exists.": "The error message. Displayed when provided name already exists.",
"bookmark widget": "The label for the bookmark widget."
"bookmark widget": "The label for the bookmark widget.",
"Bookmark toolbar": "The label used by assistive technologies describing an bookmark toolbar attached to a bookmark widget."
}
4 changes: 2 additions & 2 deletions packages/ckeditor5-bookmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"dependencies": {
"ckeditor5": "43.3.1",
"@ckeditor/ckeditor5-core": "43.3.1",
"@ckeditor/ckeditor5-engine": "43.3.1",
"@ckeditor/ckeditor5-widget": "43.3.1",
"@ckeditor/ckeditor5-utils": "43.3.1",
"@ckeditor/ckeditor5-ui": "43.3.1"
Expand All @@ -28,13 +27,14 @@
"@ckeditor/ckeditor5-dev-utils": "^45.0.0",
"@ckeditor/ckeditor5-easy-image": "43.3.1",
"@ckeditor/ckeditor5-editor-classic": "43.3.1",
"@ckeditor/ckeditor5-editor-multi-root": "43.3.1",
"@ckeditor/ckeditor5-engine": "43.3.1",
"@ckeditor/ckeditor5-essentials": "43.3.1",
"@ckeditor/ckeditor5-heading": "43.3.1",
"@ckeditor/ckeditor5-html-support": "43.3.1",
"@ckeditor/ckeditor5-image": "43.3.1",
"@ckeditor/ckeditor5-link": "43.3.1",
"@ckeditor/ckeditor5-list": "43.3.1",
"@ckeditor/ckeditor5-editor-multi-root": "43.3.1",
"@ckeditor/ckeditor5-paragraph": "43.3.1",
"@ckeditor/ckeditor5-paste-from-office": "43.3.1",
"@ckeditor/ckeditor5-table": "43.3.1",
Expand Down
25 changes: 25 additions & 0 deletions packages/ckeditor5-bookmark/src/bookmarkconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,29 @@ export interface BookmarkConfig {
* @default true
*/
enableNonEmptyAnchorConversion?: boolean;

/**
* Items to be placed in the bookmark contextual toolbar.
*
* Assuming that you use the {@link module:bookmark/bookmarkui~BookmarkUI} feature, the following toolbar items will be available
* in {@link module:ui/componentfactory~ComponentFactory}:
*
* * `'bookmarkPreview'`,
* * `'editBookmark'`,
* * `'removeBookmark'`.
*
* The default configuration for bookmark toolbar is:
*
* ```ts
* const bookmarkConfig = {
* toolbar: [ 'bookmarkPreview', '|', 'editBookmark', 'removeBookmark' ]
* };
* ```
*
* Of course, the same buttons can also be used in the
* {@link module:core/editor/editorconfig~EditorConfig#toolbar main editor toolbar}.
*
* Read more about configuring the toolbar in {@link module:core/editor/editorconfig~EditorConfig#toolbar}.
*/
toolbar?: Array<string>;
}
21 changes: 20 additions & 1 deletion packages/ckeditor5-bookmark/src/bookmarkediting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @module bookmark/bookmarkediting
*/

import { type Editor, Plugin, icons } from 'ckeditor5/src/core.js';
import { Plugin, icons, type Editor } from 'ckeditor5/src/core.js';
import { toWidget } from 'ckeditor5/src/widget.js';
import { IconView } from 'ckeditor5/src/ui.js';
import type { EventInfo } from 'ckeditor5/src/utils.js';
Expand Down Expand Up @@ -51,6 +51,17 @@ export default class BookmarkEditing extends Plugin {
return true;
}

/**
* @inheritDoc
*/
constructor( editor: Editor ) {
super( editor );

editor.config.define( 'bookmark', {
toolbar: [ 'bookmarkPreview', '|', 'editBookmark', 'removeBookmark' ]
} );
}

/**
* @inheritDoc
*/
Expand Down Expand Up @@ -81,6 +92,13 @@ export default class BookmarkEditing extends Plugin {
return null;
}

/**
* Returns all unique bookmark names existing in the content.
*/
public getAllBookmarkNames(): Set<string> {
return new Set( this._bookmarkElements.values() );
}

/**
* Defines the schema for the bookmark feature.
*/
Expand Down Expand Up @@ -135,6 +153,7 @@ export default class BookmarkEditing extends Plugin {
class: 'ck-bookmark'
}, [ this._createBookmarkUIElement( writer ) ] );

writer.setCustomProperty( 'bookmark', true, containerElement );
this._bookmarkElements.set( modelElement, id );

// `getFillerOffset` is not needed to set here, because `toWidget` has already covered it.
Expand Down
Loading