@ckeditor/ckeditor5-bookmark 0.0.0-nightly-next-20250302.0 → 0.0.0-nightly-20250303.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/build/bookmark.js +2 -2
  2. package/build/translations/af.js +1 -1
  3. package/build/translations/ar.js +1 -1
  4. package/build/translations/ast.js +1 -1
  5. package/build/translations/az.js +1 -1
  6. package/build/translations/bg.js +1 -1
  7. package/build/translations/bn.js +1 -1
  8. package/build/translations/bs.js +1 -1
  9. package/build/translations/ca.js +1 -1
  10. package/build/translations/cs.js +1 -1
  11. package/build/translations/da.js +1 -1
  12. package/build/translations/de-ch.js +1 -1
  13. package/build/translations/de.js +1 -1
  14. package/build/translations/el.js +1 -1
  15. package/build/translations/en-au.js +1 -1
  16. package/build/translations/en-gb.js +1 -1
  17. package/build/translations/eo.js +1 -1
  18. package/build/translations/es-co.js +1 -1
  19. package/build/translations/es.js +1 -1
  20. package/build/translations/et.js +1 -1
  21. package/build/translations/eu.js +1 -1
  22. package/build/translations/fa.js +1 -1
  23. package/build/translations/fi.js +1 -1
  24. package/build/translations/fr.js +1 -1
  25. package/build/translations/gl.js +1 -1
  26. package/build/translations/gu.js +1 -1
  27. package/build/translations/he.js +1 -1
  28. package/build/translations/hi.js +1 -1
  29. package/build/translations/hr.js +1 -1
  30. package/build/translations/hu.js +1 -1
  31. package/build/translations/hy.js +1 -1
  32. package/build/translations/id.js +1 -1
  33. package/build/translations/it.js +1 -1
  34. package/build/translations/ja.js +1 -1
  35. package/build/translations/jv.js +1 -1
  36. package/build/translations/kk.js +1 -1
  37. package/build/translations/km.js +1 -1
  38. package/build/translations/kn.js +1 -1
  39. package/build/translations/ko.js +1 -1
  40. package/build/translations/ku.js +1 -1
  41. package/build/translations/lt.js +1 -1
  42. package/build/translations/lv.js +1 -1
  43. package/build/translations/ms.js +1 -1
  44. package/build/translations/nb.js +1 -1
  45. package/build/translations/ne.js +1 -1
  46. package/build/translations/nl.js +1 -1
  47. package/build/translations/no.js +1 -1
  48. package/build/translations/oc.js +1 -1
  49. package/build/translations/pl.js +1 -1
  50. package/build/translations/pt-br.js +1 -1
  51. package/build/translations/pt.js +1 -1
  52. package/build/translations/ro.js +1 -1
  53. package/build/translations/ru.js +1 -1
  54. package/build/translations/si.js +1 -1
  55. package/build/translations/sk.js +1 -1
  56. package/build/translations/sl.js +1 -1
  57. package/build/translations/sq.js +1 -1
  58. package/build/translations/sr-latn.js +1 -1
  59. package/build/translations/sr.js +1 -1
  60. package/build/translations/sv.js +1 -1
  61. package/build/translations/th.js +1 -1
  62. package/build/translations/ti.js +1 -1
  63. package/build/translations/tk.js +1 -1
  64. package/build/translations/tr.js +1 -1
  65. package/build/translations/tt.js +1 -1
  66. package/build/translations/ug.js +1 -1
  67. package/build/translations/uk.js +1 -1
  68. package/build/translations/ur.js +1 -1
  69. package/build/translations/uz.js +1 -1
  70. package/build/translations/vi.js +1 -1
  71. package/build/translations/zh-cn.js +1 -1
  72. package/build/translations/zh.js +1 -1
  73. package/ckeditor5-metadata.json +1 -1
  74. package/dist/index-editor.css +101 -56
  75. package/dist/index.css +119 -59
  76. package/dist/index.css.map +1 -1
  77. package/dist/index.js +389 -282
  78. package/dist/index.js.map +1 -1
  79. package/lang/contexts.json +3 -5
  80. package/package.json +7 -8
  81. package/src/bookmarkconfig.d.ts +0 -24
  82. package/src/bookmarkediting.d.ts +1 -9
  83. package/src/bookmarkediting.js +9 -23
  84. package/src/bookmarkui.d.ts +57 -24
  85. package/src/bookmarkui.js +212 -207
  86. package/src/ui/bookmarkactionsview.d.ts +102 -0
  87. package/src/ui/bookmarkactionsview.js +154 -0
  88. package/src/ui/bookmarkformview.d.ts +14 -24
  89. package/src/ui/bookmarkformview.js +62 -103
  90. package/theme/bookmark.css +46 -0
  91. package/theme/bookmarkactions.css +44 -0
  92. package/theme/bookmarkform.css +38 -0
  93. package/theme/bookmarktoolbar.css +0 -4
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "Bookmark": "The label of the bookmark toolbar button. Also, a bookmark form header.",
3
+ "Insert": "The button in the bookmark insert form.",
4
+ "Update": "The button in the bookmark update form.",
3
5
  "Edit bookmark": "Button opening the Bookmark editing balloon.",
4
6
  "Remove bookmark": "Toolbar button tooltip for bookmark remove button.",
5
7
  "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.",
@@ -7,9 +9,5 @@
7
9
  "Bookmark must not be empty.": "The error message. Displayed when the bookmark name is empty.",
8
10
  "Bookmark name cannot contain space characters.": "The error message. Displayed when provided name includes spaces.",
9
11
  "Bookmark name already exists.": "The error message. Displayed when provided name already exists.",
10
- "bookmark widget": "The label for the bookmark widget.",
11
- "Bookmark toolbar": "The label used by assistive technologies describing an bookmark toolbar attached to a bookmark widget.",
12
- "Bookmarks": "Title for a feature displaying a list of bookmarks.",
13
- "No bookmarks available.": "A message displayed instead of a list of bookmarks if it is empty.",
14
- "Scroll to bookmark": "Tooltip shown after hovering the bookmark link preview."
12
+ "bookmark widget": "The label for the bookmark widget."
15
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-bookmark",
3
- "version": "0.0.0-nightly-next-20250302.0",
3
+ "version": "0.0.0-nightly-20250303.0",
4
4
  "description": "Bookmark feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,13 +13,12 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "ckeditor5": "0.0.0-nightly-next-20250302.0",
17
- "@ckeditor/ckeditor5-core": "0.0.0-nightly-next-20250302.0",
18
- "@ckeditor/ckeditor5-icons": "0.0.0-nightly-next-20250302.0",
19
- "@ckeditor/ckeditor5-widget": "0.0.0-nightly-next-20250302.0",
20
- "@ckeditor/ckeditor5-utils": "0.0.0-nightly-next-20250302.0",
21
- "@ckeditor/ckeditor5-ui": "0.0.0-nightly-next-20250302.0",
22
- "@ckeditor/ckeditor5-link": "0.0.0-nightly-next-20250302.0"
16
+ "ckeditor5": "0.0.0-nightly-20250303.0",
17
+ "@ckeditor/ckeditor5-core": "0.0.0-nightly-20250303.0",
18
+ "@ckeditor/ckeditor5-engine": "0.0.0-nightly-20250303.0",
19
+ "@ckeditor/ckeditor5-widget": "0.0.0-nightly-20250303.0",
20
+ "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250303.0",
21
+ "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20250303.0"
23
22
  },
24
23
  "author": "CKSource (http://cksource.com/)",
25
24
  "license": "SEE LICENSE IN LICENSE.md",
@@ -45,28 +45,4 @@ export interface BookmarkConfig {
45
45
  * @default true
46
46
  */
47
47
  enableNonEmptyAnchorConversion?: boolean;
48
- /**
49
- * Items to be placed in the bookmark contextual toolbar.
50
- *
51
- * Assuming that you use the {@link module:bookmark/bookmarkui~BookmarkUI} feature, the following toolbar items will be available
52
- * in {@link module:ui/componentfactory~ComponentFactory}:
53
- *
54
- * * `'bookmarkPreview'`,
55
- * * `'editBookmark'`,
56
- * * `'removeBookmark'`.
57
- *
58
- * The default configuration for bookmark toolbar is:
59
- *
60
- * ```ts
61
- * const bookmarkConfig = {
62
- * toolbar: [ 'bookmarkPreview', '|', 'editBookmark', 'removeBookmark' ]
63
- * };
64
- * ```
65
- *
66
- * Of course, the same buttons can also be used in the
67
- * {@link module:core/editor/editorconfig~EditorConfig#toolbar main editor toolbar}.
68
- *
69
- * Read more about configuring the toolbar in {@link module:core/editor/editorconfig~EditorConfig#toolbar}.
70
- */
71
- toolbar?: Array<string>;
72
48
  }
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * @module bookmark/bookmarkediting
7
7
  */
8
- import { type Editor, Plugin } from 'ckeditor5/src/core.js';
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
9
  import type { Element } from 'ckeditor5/src/engine.js';
10
10
  import '../theme/bookmark.css';
11
11
  /**
@@ -24,10 +24,6 @@ export default class BookmarkEditing extends Plugin {
24
24
  * @inheritDoc
25
25
  */
26
26
  static get isOfficialPlugin(): true;
27
- /**
28
- * @inheritDoc
29
- */
30
- constructor(editor: Editor);
31
27
  /**
32
28
  * @inheritDoc
33
29
  */
@@ -36,10 +32,6 @@ export default class BookmarkEditing extends Plugin {
36
32
  * Returns the model element for the given bookmark ID if it exists.
37
33
  */
38
34
  getElementForBookmarkId(bookmarkId: string): Element | null;
39
- /**
40
- * Returns all unique bookmark names existing in the content.
41
- */
42
- getAllBookmarkNames(): Set<string>;
43
35
  /**
44
36
  * Defines the schema for the bookmark feature.
45
37
  */
@@ -5,10 +5,9 @@
5
5
  /**
6
6
  * @module bookmark/bookmarkediting
7
7
  */
8
- import { Plugin } from 'ckeditor5/src/core.js';
8
+ import { Plugin, icons } from 'ckeditor5/src/core.js';
9
9
  import { toWidget } from 'ckeditor5/src/widget.js';
10
10
  import { IconView } from 'ckeditor5/src/ui.js';
11
- import { IconBookmarkInline } from 'ckeditor5/src/icons.js';
12
11
  import InsertBookmarkCommand from './insertbookmarkcommand.js';
13
12
  import UpdateBookmarkCommand from './updatebookmarkcommand.js';
14
13
  import '../theme/bookmark.css';
@@ -16,10 +15,13 @@ import '../theme/bookmark.css';
16
15
  * The bookmark editing plugin.
17
16
  */
18
17
  export default class BookmarkEditing extends Plugin {
19
- /**
20
- * A collection of bookmarks elements in the document.
21
- */
22
- _bookmarkElements = new Map();
18
+ constructor() {
19
+ super(...arguments);
20
+ /**
21
+ * A collection of bookmarks elements in the document.
22
+ */
23
+ this._bookmarkElements = new Map();
24
+ }
23
25
  /**
24
26
  * @inheritDoc
25
27
  */
@@ -32,15 +34,6 @@ export default class BookmarkEditing extends Plugin {
32
34
  static get isOfficialPlugin() {
33
35
  return true;
34
36
  }
35
- /**
36
- * @inheritDoc
37
- */
38
- constructor(editor) {
39
- super(editor);
40
- editor.config.define('bookmark', {
41
- toolbar: ['bookmarkPreview', '|', 'editBookmark', 'removeBookmark']
42
- });
43
- }
44
37
  /**
45
38
  * @inheritDoc
46
39
  */
@@ -65,12 +58,6 @@ export default class BookmarkEditing extends Plugin {
65
58
  }
66
59
  return null;
67
60
  }
68
- /**
69
- * Returns all unique bookmark names existing in the content.
70
- */
71
- getAllBookmarkNames() {
72
- return new Set(this._bookmarkElements.values());
73
- }
74
61
  /**
75
62
  * Defines the schema for the bookmark feature.
76
63
  */
@@ -116,7 +103,6 @@ export default class BookmarkEditing extends Plugin {
116
103
  id,
117
104
  class: 'ck-bookmark'
118
105
  }, [this._createBookmarkUIElement(writer)]);
119
- writer.setCustomProperty('bookmark', true, containerElement);
120
106
  this._bookmarkElements.set(modelElement, id);
121
107
  // `getFillerOffset` is not needed to set here, because `toWidget` has already covered it.
122
108
  const labelCreator = () => `${id} ${t('bookmark widget')}`;
@@ -133,7 +119,7 @@ export default class BookmarkEditing extends Plugin {
133
119
  const domElement = this.toDomElement(domDocument);
134
120
  const icon = new IconView();
135
121
  icon.set({
136
- content: IconBookmarkInline,
122
+ content: icons.bookmarkInline,
137
123
  isColorInherited: false
138
124
  });
139
125
  icon.render();
@@ -2,12 +2,14 @@
2
2
  * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
4
  */
5
+ /**
6
+ * @module bookmark/bookmarkui
7
+ */
5
8
  import { Plugin } from 'ckeditor5/src/core.js';
6
9
  import { ContextualBalloon, type ViewWithCssTransitionDisabler } from 'ckeditor5/src/ui.js';
7
- import { WidgetToolbarRepository } from 'ckeditor5/src/widget.js';
8
10
  import BookmarkFormView from './ui/bookmarkformview.js';
11
+ import BookmarkActionsView from './ui/bookmarkactionsview.js';
9
12
  import BookmarkEditing from './bookmarkediting.js';
10
- import '../theme/bookmarktoolbar.css';
11
13
  /**
12
14
  * The UI plugin of the bookmark feature.
13
15
  *
@@ -15,6 +17,10 @@ import '../theme/bookmarktoolbar.css';
15
17
  * which inserts the `bookmark` element upon selection.
16
18
  */
17
19
  export default class BookmarkUI extends Plugin {
20
+ /**
21
+ * The actions view displayed inside of the balloon.
22
+ */
23
+ actionsView: BookmarkActionsView | null;
18
24
  /**
19
25
  * The form view displayed inside the balloon.
20
26
  */
@@ -26,7 +32,7 @@ export default class BookmarkUI extends Plugin {
26
32
  /**
27
33
  * @inheritDoc
28
34
  */
29
- static get requires(): readonly [typeof BookmarkEditing, typeof ContextualBalloon, typeof WidgetToolbarRepository];
35
+ static get requires(): readonly [typeof BookmarkEditing, typeof ContextualBalloon];
30
36
  /**
31
37
  * @inheritDoc
32
38
  */
@@ -39,10 +45,6 @@ export default class BookmarkUI extends Plugin {
39
45
  * @inheritDoc
40
46
  */
41
47
  init(): void;
42
- /**
43
- * @inheritDoc
44
- */
45
- afterInit(): void;
46
48
  /**
47
49
  * @inheritDoc
48
50
  */
@@ -52,53 +54,70 @@ export default class BookmarkUI extends Plugin {
52
54
  */
53
55
  private _createViews;
54
56
  /**
55
- * Creates the {@link module:bookmark/ui/bookmarkformview~BookmarkFormView} instance.
57
+ * Creates the {@link module:bookmark/ui/bookmarkactionsview~BookmarkActionsView} instance.
56
58
  */
57
- private _createFormView;
58
- /**
59
- * Creates link form menu list entry, so it'll be possible to access
60
- * the list of the bookmarks from the link form.
61
- */
62
- private _registerLinkProvider;
59
+ private _createActionsView;
63
60
  /**
64
- * Scrolls the editor to the bookmark with the given id.
61
+ * Creates the {@link module:bookmark/ui/bookmarkformview~BookmarkFormView} instance.
65
62
  */
66
- private _scrollToBookmark;
63
+ private _createFormView;
67
64
  /**
68
65
  * Creates a toolbar Bookmark button. Clicking this button will show
69
66
  * a {@link #_balloon} attached to the selection.
70
67
  */
71
- private _registerComponents;
68
+ private _createToolbarBookmarkButton;
72
69
  /**
73
70
  * Creates a button for `bookmark` command to use either in toolbar or in menu bar.
74
71
  */
75
- private _createBookmarkButton;
72
+ private _createButton;
73
+ /**
74
+ * Attaches actions that control whether the balloon panel containing the
75
+ * {@link #formView} should be displayed.
76
+ */
77
+ private _enableBalloonActivators;
76
78
  /**
77
79
  * Attaches actions that control whether the balloon panel containing the
78
80
  * {@link #formView} is visible or not.
79
81
  */
80
82
  private _enableUserBalloonInteractions;
83
+ /**
84
+ * Updates the button label. If bookmark is selected label is set to 'Update' otherwise
85
+ * it is 'Insert'.
86
+ */
87
+ private _updateFormButtonLabel;
88
+ /**
89
+ * Adds the {@link #actionsView} to the {@link #_balloon}.
90
+ *
91
+ * @internal
92
+ */
93
+ _addActionsView(): void;
81
94
  /**
82
95
  * Adds the {@link #formView} to the {@link #_balloon}.
83
96
  */
84
97
  private _addFormView;
98
+ /**
99
+ * Closes the form view. Decides whether the balloon should be hidden completely.
100
+ */
101
+ private _closeFormView;
85
102
  /**
86
103
  * Removes the {@link #formView} from the {@link #_balloon}.
87
104
  */
88
105
  private _removeFormView;
89
106
  /**
90
- * Shows the {@link #formView}.
107
+ * Shows the correct UI type. It is either {@link #formView} or {@link #actionsView}.
91
108
  */
92
- private _showFormView;
109
+ private _showUI;
93
110
  /**
94
111
  * Removes the {@link #formView} from the {@link #_balloon}.
112
+ *
113
+ * See {@link #_addFormView}, {@link #_addActionsView}.
95
114
  */
96
- private _hideFormView;
115
+ private _hideUI;
97
116
  /**
98
117
  * Makes the UI react to the {@link module:ui/editorui/editorui~EditorUI#event:update} event to
99
118
  * reposition itself when the editor UI should be refreshed.
100
119
  *
101
- * See: {@link #_hideFormView} to learn when the UI stops reacting to the `update` event.
120
+ * See: {@link #_hideUI} to learn when the UI stops reacting to the `update` event.
102
121
  */
103
122
  private _startUpdatingUI;
104
123
  /**
@@ -106,9 +125,23 @@ export default class BookmarkUI extends Plugin {
106
125
  */
107
126
  private get _isFormInPanel();
108
127
  /**
109
- * Returns `true` when {@link #formView} is in the {@link #_balloon} and it is currently visible.
128
+ * Returns `true` when {@link #actionsView} is in the {@link #_balloon}.
129
+ */
130
+ private get _areActionsInPanel();
131
+ /**
132
+ * Returns `true` when {@link #actionsView} is in the {@link #_balloon} and it is
133
+ * currently visible.
134
+ */
135
+ private get _areActionsVisible();
136
+ /**
137
+ * Returns `true` when {@link #actionsView} or {@link #formView} is in the {@link #_balloon}.
138
+ */
139
+ private get _isUIInPanel();
140
+ /**
141
+ * Returns `true` when {@link #actionsView} or {@link #formView} is in the {@link #_balloon} and it is
142
+ * currently visible.
110
143
  */
111
- private get _isFormVisible();
144
+ private get _isUIVisible();
112
145
  /**
113
146
  * Returns positioning options for the {@link #_balloon}. They control the way the balloon is attached
114
147
  * to the target element or selection.