@ckeditor/ckeditor5-link 45.2.1 → 46.0.0-alpha.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 (44) hide show
  1. package/build/link.js +1 -1
  2. package/dist/index-editor.css +11 -11
  3. package/dist/index.css +15 -15
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.js +24 -24
  6. package/dist/index.js.map +1 -1
  7. package/package.json +12 -12
  8. package/src/autolink.d.ts +2 -2
  9. package/src/autolink.js +2 -2
  10. package/src/index.d.ts +23 -12
  11. package/src/index.js +17 -11
  12. package/src/link.d.ts +4 -4
  13. package/src/link.js +4 -4
  14. package/src/linkcommand.d.ts +7 -7
  15. package/src/linkcommand.js +8 -8
  16. package/src/linkconfig.d.ts +6 -6
  17. package/src/linkediting.d.ts +6 -6
  18. package/src/linkediting.js +11 -11
  19. package/src/linkimage.d.ts +3 -3
  20. package/src/linkimage.js +3 -3
  21. package/src/linkimageediting.d.ts +3 -3
  22. package/src/linkimageediting.js +3 -3
  23. package/src/linkimageui.d.ts +3 -3
  24. package/src/linkimageui.js +3 -3
  25. package/src/linkui.d.ts +7 -7
  26. package/src/linkui.js +9 -9
  27. package/src/ui/linkbuttonview.d.ts +1 -1
  28. package/src/ui/linkbuttonview.js +1 -1
  29. package/src/ui/linkformview.d.ts +3 -3
  30. package/src/ui/linkformview.js +1 -1
  31. package/src/ui/linkpreviewbuttonview.d.ts +1 -1
  32. package/src/ui/linkpreviewbuttonview.js +1 -1
  33. package/src/ui/linkpropertiesview.d.ts +2 -2
  34. package/src/ui/linkpropertiesview.js +1 -1
  35. package/src/ui/linkprovideritemsview.d.ts +2 -2
  36. package/src/ui/linkprovideritemsview.js +1 -1
  37. package/src/unlinkcommand.d.ts +1 -1
  38. package/src/unlinkcommand.js +1 -1
  39. package/src/utils/automaticdecorators.d.ts +1 -1
  40. package/src/utils/automaticdecorators.js +1 -1
  41. package/src/utils/manualdecorator.d.ts +7 -7
  42. package/src/utils/manualdecorator.js +6 -6
  43. package/src/utils.d.ts +4 -4
  44. package/src/utils.js +1 -1
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command, Plugin } from '@ckeditor/ckeditor5-core/dist/index.js';
6
6
  import { findAttributeRange, TwoStepCaretMovement, Input, inlineHighlight, Delete, TextWatcher, getLastTextLine } from '@ckeditor/ckeditor5-typing/dist/index.js';
7
7
  import { ClipboardPipeline } from '@ckeditor/ckeditor5-clipboard/dist/index.js';
8
8
  import { toMap, Collection, first, diff, ObservableMixin, env, keyCodes, FocusTracker, KeystrokeHandler } from '@ckeditor/ckeditor5-utils/dist/index.js';
9
- import { LivePosition, ClickObserver, Matcher } from '@ckeditor/ckeditor5-engine/dist/index.js';
9
+ import { ModelLivePosition, ClickObserver, Matcher } from '@ckeditor/ckeditor5-engine/dist/index.js';
10
10
  import { upperFirst } from 'es-toolkit/compat';
11
11
  import { IconPreviousArrow, IconUnlink, IconPencil, IconSettings, IconLink } from '@ckeditor/ckeditor5-icons/dist/index.js';
12
12
  import { ButtonView, View, ViewCollection, FocusCycler, submitHandler, FormHeaderView, ListView, ListItemView, LabeledFieldView, createLabeledInputText, FormRowView, IconView, ContextualBalloon, ToolbarView, CssTransitionDisablerMixin, SwitchButtonView, MenuBarMenuListItemButtonView, clickOutsideHandler } from '@ckeditor/ckeditor5-ui/dist/index.js';
@@ -160,7 +160,7 @@ const DEFAULT_LINK_PROTOCOLS = [
160
160
  return node.is('attributeElement') && !!node.getCustomProperty('link');
161
161
  }
162
162
  /**
163
- * Creates a link {@link module:engine/view/attributeelement~AttributeElement} with the provided `href` attribute.
163
+ * Creates a link {@link module:engine/view/attributeelement~ViewAttributeElement} with the provided `href` attribute.
164
164
  */ function createLinkElement(href, { writer }) {
165
165
  // Priority 5 - https://github.com/ckeditor/ckeditor5-link/issues/121.
166
166
  const linkElement = writer.createAttributeElement('a', {
@@ -282,7 +282,7 @@ const DEFAULT_LINK_PROTOCOLS = [
282
282
  * The link command. It is used by the {@link module:link/link~Link link feature}.
283
283
  */ class LinkCommand extends Command {
284
284
  /**
285
- * A collection of {@link module:link/utils/manualdecorator~ManualDecorator manual decorators}
285
+ * A collection of {@link module:link/utils/manualdecorator~LinkManualDecorator manual decorators}
286
286
  * corresponding to the {@link module:link/linkconfig~LinkConfig#decorators decorator configuration}.
287
287
  *
288
288
  * You can consider it a model with states of manual decorators added to the currently selected link.
@@ -324,7 +324,7 @@ const DEFAULT_LINK_PROTOCOLS = [
324
324
  * those nodes where the `linkHref` attribute is allowed (disallowed nodes will be omitted).
325
325
  *
326
326
  * When the selection is collapsed and is not inside the text with the `linkHref` attribute, a
327
- * new {@link module:engine/model/text~Text text node} with the `linkHref` attribute will be inserted in place of the caret, but
327
+ * new {@link module:engine/model/text~ModelText text node} with the `linkHref` attribute will be inserted in place of the caret, but
328
328
  * only if such element is allowed in this place. The `_data` of the inserted text will equal the `href` parameter.
329
329
  * The selection will be updated to wrap the just inserted text node.
330
330
  *
@@ -334,7 +334,7 @@ const DEFAULT_LINK_PROTOCOLS = [
334
334
  *
335
335
  * There is an optional argument to this command that applies or removes model
336
336
  * {@glink framework/architecture/editing-engine#text-attributes text attributes} brought by
337
- * {@link module:link/utils/manualdecorator~ManualDecorator manual link decorators}.
337
+ * {@link module:link/utils/manualdecorator~LinkManualDecorator manual link decorators}.
338
338
  *
339
339
  * Text attribute names in the model correspond to the entries in the {@link module:link/linkconfig~LinkConfig#decorators
340
340
  * configuration}.
@@ -523,8 +523,8 @@ const DEFAULT_LINK_PROTOCOLS = [
523
523
  }
524
524
  // Store the selection ranges in a pseudo live range array (stickiness to the outside of the range).
525
525
  const stickyPseudoRanges = selectionRanges.map((range)=>({
526
- start: LivePosition.fromPosition(range.start, 'toPrevious'),
527
- end: LivePosition.fromPosition(range.end, 'toNext')
526
+ start: ModelLivePosition.fromPosition(range.start, 'toPrevious'),
527
+ end: ModelLivePosition.fromPosition(range.end, 'toNext')
528
528
  }));
529
529
  // Update or set links (including text update if needed).
530
530
  for (let range of rangesToUpdate){
@@ -723,10 +723,10 @@ const DEFAULT_LINK_PROTOCOLS = [
723
723
  }
724
724
 
725
725
  /**
726
- * Helper class that stores manual decorators with observable {@link module:link/utils/manualdecorator~ManualDecorator#value}
726
+ * Helper class that stores manual decorators with observable {@link module:link/utils/manualdecorator~LinkManualDecorator#value}
727
727
  * to support integration with the UI state. An instance of this class is a model with the state of individual manual decorators.
728
728
  * These decorators are kept as collections in {@link module:link/linkcommand~LinkCommand#manualDecorators}.
729
- */ class ManualDecorator extends /* #__PURE__ */ ObservableMixin() {
729
+ */ class LinkManualDecorator extends /* #__PURE__ */ ObservableMixin() {
730
730
  /**
731
731
  * An ID of a manual decorator which is the name of the attribute in the model, for example: 'linkManualDecorator0'.
732
732
  */ id;
@@ -738,18 +738,18 @@ const DEFAULT_LINK_PROTOCOLS = [
738
738
  */ label;
739
739
  /**
740
740
  * A set of attributes added to downcasted data when the decorator is activated for a specific link.
741
- * Attributes should be added in a form of attributes defined in {@link module:engine/view/elementdefinition~ElementDefinition}.
741
+ * Attributes should be added in a form of attributes defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.
742
742
  */ attributes;
743
743
  /**
744
744
  * A set of classes added to downcasted data when the decorator is activated for a specific link.
745
- * Classes should be added in a form of classes defined in {@link module:engine/view/elementdefinition~ElementDefinition}.
745
+ * Classes should be added in a form of classes defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.
746
746
  */ classes;
747
747
  /**
748
748
  * A set of styles added to downcasted data when the decorator is activated for a specific link.
749
- * Styles should be added in a form of styles defined in {@link module:engine/view/elementdefinition~ElementDefinition}.
749
+ * Styles should be added in a form of styles defined in {@link module:engine/view/elementdefinition~ViewElementDefinition}.
750
750
  */ styles;
751
751
  /**
752
- * Creates a new instance of {@link module:link/utils/manualdecorator~ManualDecorator}.
752
+ * Creates a new instance of {@link module:link/utils/manualdecorator~LinkManualDecorator}.
753
753
  *
754
754
  * @param options The configuration object.
755
755
  */ constructor({ id, label, attributes, classes, styles, defaultValue }){
@@ -868,7 +868,7 @@ const EXTERNAL_LINKS_REGEXP = /^(https?:)?\/\//;
868
868
  inlineHighlight(editor, 'linkHref', 'a', HIGHLIGHT_CLASS);
869
869
  // Handle link following by CTRL+click or ALT+ENTER
870
870
  this._enableLinkOpen();
871
- // Clears the DocumentSelection decorator attributes if the selection is no longer in a link (for example while using 2-SCM).
871
+ // Clears the ModelDocumentSelection decorator attributes if the selection is no longer in a link (for example while using 2-SCM).
872
872
  this._enableSelectionAttributesFixer();
873
873
  // Handle adding default protocol to pasted links.
874
874
  this._enableClipboardIntegration();
@@ -914,11 +914,11 @@ const EXTERNAL_LINKS_REGEXP = /^(https?:)?\/\//;
914
914
  }
915
915
  /**
916
916
  * Processes an array of configured {@link module:link/linkconfig~LinkDecoratorManualDefinition manual decorators},
917
- * transforms them into {@link module:link/utils/manualdecorator~ManualDecorator} instances and stores them in the
917
+ * transforms them into {@link module:link/utils/manualdecorator~LinkManualDecorator} instances and stores them in the
918
918
  * {@link module:link/linkcommand~LinkCommand#manualDecorators} collection (a model for manual decorators state).
919
919
  *
920
920
  * Also registers an {@link module:engine/conversion/downcasthelpers~DowncastHelpers#attributeToElement attribute-to-element}
921
- * converter for each manual decorator and extends the {@link module:engine/model/schema~Schema model's schema}
921
+ * converter for each manual decorator and extends the {@link module:engine/model/schema~ModelSchema model's schema}
922
922
  * with adequate model attributes.
923
923
  */ _enableManualDecorators(manualDecoratorDefinitions) {
924
924
  if (!manualDecoratorDefinitions.length) {
@@ -932,7 +932,7 @@ const EXTERNAL_LINKS_REGEXP = /^(https?:)?\/\//;
932
932
  allowAttributes: decoratorDefinition.id
933
933
  });
934
934
  // Keeps reference to manual decorator to decode its name to attributes during downcast.
935
- const decorator = new ManualDecorator(decoratorDefinition);
935
+ const decorator = new LinkManualDecorator(decoratorDefinition);
936
936
  manualDecorators.add(decorator);
937
937
  editor.conversion.for('downcast').attributeToElement({
938
938
  model: decorator.id,
@@ -968,8 +968,8 @@ const EXTERNAL_LINKS_REGEXP = /^(https?:)?\/\//;
968
968
  });
969
969
  }
970
970
  /**
971
- * Attaches handlers for {@link module:engine/view/document~Document#event:enter} and
972
- * {@link module:engine/view/document~Document#event:click} to enable link following.
971
+ * Attaches handlers for {@link module:engine/view/document~ViewDocument#event:enter} and
972
+ * {@link module:engine/view/document~ViewDocument#event:click} to enable link following.
973
973
  */ _enableLinkOpen() {
974
974
  const editor = this.editor;
975
975
  const view = editor.editing.view;
@@ -1014,7 +1014,7 @@ const EXTERNAL_LINKS_REGEXP = /^(https?:)?\/\//;
1014
1014
  });
1015
1015
  }
1016
1016
  /**
1017
- * Watches the DocumentSelection attribute changes and removes link decorator attributes when the linkHref attribute is removed.
1017
+ * Watches the ModelDocumentSelection attribute changes and removes link decorator attributes when the linkHref attribute is removed.
1018
1018
  *
1019
1019
  * This is to ensure that there is no left-over link decorator attributes on the document selection that is no longer in a link.
1020
1020
  */ _enableSelectionAttributesFixer() {
@@ -2591,8 +2591,8 @@ const VISUAL_SELECTION_MARKER_NAME = 'link-ui';
2591
2591
  };
2592
2592
  }
2593
2593
  /**
2594
- * Returns the link {@link module:engine/view/attributeelement~AttributeElement} under
2595
- * the {@link module:engine/view/document~Document editing view's} selection or `null`
2594
+ * Returns the link {@link module:engine/view/attributeelement~ViewAttributeElement} under
2595
+ * the {@link module:engine/view/document~ViewDocument editing view's} selection or `null`
2596
2596
  * if there is none.
2597
2597
  *
2598
2598
  * **Note**: For a non–collapsed selection, the link element is returned when **fully**
@@ -3063,7 +3063,7 @@ function linkIsAlreadySet(range) {
3063
3063
  }
3064
3064
  }
3065
3065
  /**
3066
- * Processes transformed {@link module:link/utils/manualdecorator~ManualDecorator} instances and attaches proper converters
3066
+ * Processes transformed {@link module:link/utils/manualdecorator~LinkManualDecorator} instances and attaches proper converters
3067
3067
  * that will work when linking an image.
3068
3068
  */ _enableManualDecorators() {
3069
3069
  const editor = this.editor;
@@ -3386,5 +3386,5 @@ function linkIsAlreadySet(range) {
3386
3386
  }
3387
3387
  }
3388
3388
 
3389
- export { AutoLink, Link, LinkCommand, LinkEditing, LinkFormView, LinkImage, LinkImageEditing, LinkImageUI, LinkUI, UnlinkCommand, addLinkProtocolIfApplicable, ensureSafeUrl, isLinkableElement };
3389
+ export { AutoLink, AutomaticDecorators, Link, LinkCommand, LinkEditing, LinkFormView, LinkImage, LinkImageEditing, LinkImageUI, LinkManualDecorator, LinkPropertiesView, LinkProviderItemsView, LinkUI, UnlinkCommand, LINK_KEYSTROKE as _LINK_KEYSTROKE, LinkButtonView as _LinkButtonView, LinkPreviewButtonView as _LinkPreviewButtonView, createLinkElement as _createLinkElement, ensureSafeUrl as _ensureSafeLinkUrl, extractTextFromLinkRange as _extractTextFromLinkRange, getLocalizedDecorators as _getLocalizedLinkDecorators, linkHasProtocol as _hasLinkProtocol, isEmail as _isEmailLink, normalizeDecorators as _normalizeLinkDecorators, openLink as _openLink, addLinkProtocolIfApplicable, ensureSafeUrl, isLinkElement, isLinkableElement };
3390
3390
  //# sourceMappingURL=index.js.map