@ckeditor/ckeditor5-media-embed 0.0.0-nightly-20250304.0 → 0.0.0-nightly-next-20250304.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.

Potentially problematic release.


This version of @ckeditor/ckeditor5-media-embed might be problematic. Click here for more details.

@@ -6,6 +6,7 @@
6
6
  "The URL must not be empty.": "An error message that informs about an empty value in the URL input.",
7
7
  "This media URL is not supported.": "An error message that informs about unsupported media URL.",
8
8
  "Insert media": "Toolbar button tooltip for the Media Embed feature.",
9
+ "Media embed": "The label for the Media Embed balloon.",
9
10
  "Media": "Label describing type of the inserted content (e.g. 'insert media').",
10
11
  "Media toolbar": "The label used by assistive technologies describing an image toolbar attached to an image widget.",
11
12
  "Open media in new tab": "A tooltip displayed when the user hovers a non-previewable media URL in the editor content."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-media-embed",
3
- "version": "0.0.0-nightly-20250304.0",
3
+ "version": "0.0.0-nightly-next-20250304.0",
4
4
  "description": "Media embed feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,15 +13,16 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-clipboard": "0.0.0-nightly-20250304.0",
17
- "@ckeditor/ckeditor5-core": "0.0.0-nightly-20250304.0",
18
- "@ckeditor/ckeditor5-engine": "0.0.0-nightly-20250304.0",
19
- "@ckeditor/ckeditor5-typing": "0.0.0-nightly-20250304.0",
20
- "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20250304.0",
21
- "@ckeditor/ckeditor5-undo": "0.0.0-nightly-20250304.0",
22
- "@ckeditor/ckeditor5-utils": "0.0.0-nightly-20250304.0",
23
- "@ckeditor/ckeditor5-widget": "0.0.0-nightly-20250304.0",
24
- "ckeditor5": "0.0.0-nightly-20250304.0"
16
+ "@ckeditor/ckeditor5-clipboard": "0.0.0-nightly-next-20250304.0",
17
+ "@ckeditor/ckeditor5-core": "0.0.0-nightly-next-20250304.0",
18
+ "@ckeditor/ckeditor5-engine": "0.0.0-nightly-next-20250304.0",
19
+ "@ckeditor/ckeditor5-icons": "0.0.0-nightly-next-20250304.0",
20
+ "@ckeditor/ckeditor5-typing": "0.0.0-nightly-next-20250304.0",
21
+ "@ckeditor/ckeditor5-ui": "0.0.0-nightly-next-20250304.0",
22
+ "@ckeditor/ckeditor5-undo": "0.0.0-nightly-next-20250304.0",
23
+ "@ckeditor/ckeditor5-utils": "0.0.0-nightly-next-20250304.0",
24
+ "@ckeditor/ckeditor5-widget": "0.0.0-nightly-next-20250304.0",
25
+ "ckeditor5": "0.0.0-nightly-next-20250304.0"
25
26
  },
26
27
  "author": "CKSource (http://cksource.com/)",
27
28
  "license": "SEE LICENSE IN LICENSE.md",
@@ -37,6 +37,16 @@ export default class AutoMediaEmbed extends Plugin {
37
37
  static get isOfficialPlugin() {
38
38
  return true;
39
39
  }
40
+ /**
41
+ * The paste–to–embed `setTimeout` ID. Stored as a property to allow
42
+ * cleaning of the timeout.
43
+ */
44
+ _timeoutId;
45
+ /**
46
+ * The position where the `<media>` element will be inserted after the timeout,
47
+ * determined each time the new content is pasted into the document.
48
+ */
49
+ _positionToInsert;
40
50
  /**
41
51
  * @inheritDoc
42
52
  */
@@ -28,6 +28,10 @@ export default class MediaEmbedEditing extends Plugin {
28
28
  static get isOfficialPlugin() {
29
29
  return true;
30
30
  }
31
+ /**
32
+ * The media registry managing the media providers in the editor.
33
+ */
34
+ registry;
31
35
  /**
32
36
  * @inheritDoc
33
37
  */
@@ -6,10 +6,10 @@
6
6
  * @module media-embed/mediaembedui
7
7
  */
8
8
  import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { IconMedia } from 'ckeditor5/src/icons.js';
9
10
  import { ButtonView, CssTransitionDisablerMixin, MenuBarMenuListItemButtonView, Dialog } from 'ckeditor5/src/ui.js';
10
11
  import MediaFormView from './ui/mediaformview.js';
11
12
  import MediaEmbedEditing from './mediaembedediting.js';
12
- import mediaIcon from '../theme/icons/media.svg';
13
13
  /**
14
14
  * The media embed UI plugin.
15
15
  */
@@ -32,6 +32,7 @@ export default class MediaEmbedUI extends Plugin {
32
32
  static get isOfficialPlugin() {
33
33
  return true;
34
34
  }
35
+ _formView;
35
36
  /**
36
37
  * @inheritDoc
37
38
  */
@@ -59,7 +60,7 @@ export default class MediaEmbedUI extends Plugin {
59
60
  const buttonView = new ButtonClass(editor.locale);
60
61
  const command = editor.commands.get('mediaEmbed');
61
62
  const dialogPlugin = this.editor.plugins.get('Dialog');
62
- buttonView.icon = mediaIcon;
63
+ buttonView.icon = IconMedia;
63
64
  buttonView.bind('isEnabled').to(command, 'isEnabled');
64
65
  buttonView.on('execute', () => {
65
66
  if (dialogPlugin.id === 'mediaEmbed') {
@@ -76,6 +77,7 @@ export default class MediaEmbedUI extends Plugin {
76
77
  const dialog = editor.plugins.get('Dialog');
77
78
  const command = editor.commands.get('mediaEmbed');
78
79
  const t = editor.locale.t;
80
+ const isMediaSelected = command.value !== undefined;
79
81
  if (!this._formView) {
80
82
  const registry = editor.plugins.get(MediaEmbedEditing).registry;
81
83
  this._formView = new (CssTransitionDisablerMixin(MediaFormView))(getFormValidators(editor.t, registry), editor.locale);
@@ -83,7 +85,7 @@ export default class MediaEmbedUI extends Plugin {
83
85
  }
84
86
  dialog.show({
85
87
  id: 'mediaEmbed',
86
- title: t('Insert media'),
88
+ title: t('Media embed'),
87
89
  content: this._formView,
88
90
  isModal: true,
89
91
  onShow: () => {
@@ -98,7 +100,7 @@ export default class MediaEmbedUI extends Plugin {
98
100
  onExecute: () => dialog.hide()
99
101
  },
100
102
  {
101
- label: t('Accept'),
103
+ label: isMediaSelected ? t('Save') : t('Insert'),
102
104
  class: 'ck-button-action',
103
105
  withText: true,
104
106
  onExecute: () => this._handleSubmitForm()
@@ -2,11 +2,8 @@
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 media-embed/mediaregistry
7
- */
8
- import type { DowncastWriter, ViewElement } from 'ckeditor5/src/engine.js';
9
5
  import { type Locale } from 'ckeditor5/src/utils.js';
6
+ import type { DowncastWriter, ViewElement } from 'ckeditor5/src/engine.js';
10
7
  import type { MediaEmbedConfig, MediaEmbedProvider } from './mediaembedconfig.js';
11
8
  import type { MediaOptions } from './utils.js';
12
9
  /**
@@ -2,9 +2,12 @@
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 media-embed/mediaregistry
7
+ */
5
8
  import { IconView, Template } from 'ckeditor5/src/ui.js';
9
+ import { IconMediaPlaceholder } from 'ckeditor5/src/icons.js';
6
10
  import { logWarning, toArray } from 'ckeditor5/src/utils.js';
7
- import mediaPlaceholderIcon from '../theme/icons/media-placeholder.svg';
8
11
  const mediaPlaceholderIconViewBox = '0 0 64 42';
9
12
  /**
10
13
  * A bridge between the raw media content provider definitions and the editor view content.
@@ -14,6 +17,15 @@ const mediaPlaceholderIconViewBox = '0 0 64 42';
14
17
  * Mostly used by the {@link module:media-embed/mediaembedediting~MediaEmbedEditing} plugin.
15
18
  */
16
19
  export default class MediaRegistry {
20
+ /**
21
+ * The {@link module:utils/locale~Locale} instance.
22
+ */
23
+ locale;
24
+ /**
25
+ * The media provider definitions available for the registry. Usually corresponding with the
26
+ * {@link module:media-embed/mediaembedconfig~MediaEmbedConfig media configuration}.
27
+ */
28
+ providerDefinitions;
17
29
  /**
18
30
  * Creates an instance of the {@link module:media-embed/mediaregistry~MediaRegistry} class.
19
31
  *
@@ -120,6 +132,24 @@ export default class MediaRegistry {
120
132
  * It can be rendered to the {@link module:engine/view/element~Element view element} and used in the editing or data pipeline.
121
133
  */
122
134
  class Media {
135
+ /**
136
+ * The URL this Media instance represents.
137
+ */
138
+ url;
139
+ /**
140
+ * Shorthand for {@link module:utils/locale~Locale#t}.
141
+ *
142
+ * @see module:utils/locale~Locale#t
143
+ */
144
+ _locale;
145
+ /**
146
+ * The output of the `RegExp.match` which validated the {@link #url} of this media.
147
+ */
148
+ _match;
149
+ /**
150
+ * The function returning the HTML string preview of this media.
151
+ */
152
+ _previewRenderer;
123
153
  constructor(locale, url, match, previewRenderer) {
124
154
  this.url = this._getValidUrl(url);
125
155
  this._locale = locale;
@@ -177,7 +207,7 @@ class Media {
177
207
  _getPlaceholderHtml() {
178
208
  const icon = new IconView();
179
209
  const t = this._locale.t;
180
- icon.content = mediaPlaceholderIcon;
210
+ icon.content = IconMediaPlaceholder;
181
211
  icon.viewBox = mediaPlaceholderIconViewBox;
182
212
  const placeholder = new Template({
183
213
  tag: 'div',
@@ -17,6 +17,31 @@ import '../../theme/mediaform.css';
17
17
  * See {@link module:media-embed/ui/mediaformview~MediaFormView}.
18
18
  */
19
19
  export default class MediaFormView extends View {
20
+ /**
21
+ * Tracks information about the DOM focus in the form.
22
+ */
23
+ focusTracker;
24
+ /**
25
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
26
+ */
27
+ keystrokes;
28
+ /**
29
+ * The URL input view.
30
+ */
31
+ urlInputView;
32
+ /**
33
+ * An array of form validators used by {@link #isValid}.
34
+ */
35
+ _validators;
36
+ /**
37
+ * The default info text for the {@link #urlInputView}.
38
+ */
39
+ _urlInputViewInfoDefault;
40
+ /**
41
+ * The info text with an additional tip for the {@link #urlInputView},
42
+ * displayed when the input has some value.
43
+ */
44
+ _urlInputViewInfoTip;
20
45
  /**
21
46
  * @param validators Form validators used by {@link #isValid}.
22
47
  * @param locale The localization services instance.
@@ -1,20 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 20.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 400 400" style="enable-background:new 0 0 400 400;" xml:space="preserve">
5
- <style type="text/css">
6
- .st0{fill:#1DA1F2;}
7
- .st1{fill:#FFFFFF;}
8
- </style>
9
- <g id="Dark_Blue">
10
- <circle class="st0" cx="200" cy="200" r="200"/>
11
- </g>
12
- <g id="Logo__x2014__FIXED">
13
- <path class="st1" d="M163.4,305.5c88.7,0,137.2-73.5,137.2-137.2c0-2.1,0-4.2-0.1-6.2c9.4-6.8,17.6-15.3,24.1-25
14
- c-8.6,3.8-17.9,6.4-27.7,7.6c10-6,17.6-15.4,21.2-26.7c-9.3,5.5-19.6,9.5-30.6,11.7c-8.8-9.4-21.3-15.2-35.2-15.2
15
- c-26.6,0-48.2,21.6-48.2,48.2c0,3.8,0.4,7.5,1.3,11c-40.1-2-75.6-21.2-99.4-50.4c-4.1,7.1-6.5,15.4-6.5,24.2
16
- c0,16.7,8.5,31.5,21.5,40.1c-7.9-0.2-15.3-2.4-21.8-6c0,0.2,0,0.4,0,0.6c0,23.4,16.6,42.8,38.7,47.3c-4,1.1-8.3,1.7-12.7,1.7
17
- c-3.1,0-6.1-0.3-9.1-0.9c6.1,19.2,23.9,33.1,45,33.5c-16.5,12.9-37.3,20.6-59.9,20.6c-3.9,0-7.7-0.2-11.5-0.7
18
- C110.8,297.5,136.2,305.5,163.4,305.5"/>
19
- </g>
20
- </svg>
@@ -1 +0,0 @@
1
- <svg viewBox="0 0 64 42" xmlns="http://www.w3.org/2000/svg"><path d="M47.426 17V3.713L63.102 0v19.389h-.001l.001.272c0 1.595-2.032 3.43-4.538 4.098-2.506.668-4.538-.083-4.538-1.678 0-1.594 2.032-3.43 4.538-4.098.914-.244 2.032-.565 2.888-.603V4.516L49.076 7.447v9.556A1.014 1.014 0 0 0 49 17h-1.574zM29.5 17h-8.343a7.073 7.073 0 1 0-4.657 4.06v3.781H3.3a2.803 2.803 0 0 1-2.8-2.804V8.63a2.803 2.803 0 0 1 2.8-2.805h4.082L8.58 2.768A1.994 1.994 0 0 1 10.435 1.5h8.985c.773 0 1.477.448 1.805 1.149l1.488 3.177H26.7c1.546 0 2.8 1.256 2.8 2.805V17zm-11.637 0H17.5a1 1 0 0 0-1 1v.05A4.244 4.244 0 1 1 17.863 17zm29.684 2c.97 0 .953-.048.953.889v20.743c0 .953.016.905-.953.905H19.453c-.97 0-.953.048-.953-.905V19.89c0-.937-.016-.889.97-.889h28.077zm-4.701 19.338V22.183H24.154v16.155h18.692zM20.6 21.375v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616v-1.616H20.6zm0 3.231v1.616h1.616V37.53H20.6zm24.233-16.155v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615v-1.616h-1.615zm0 3.231v1.616h1.615V37.53h-1.615zM29.485 25.283a.4.4 0 0 1 .593-.35l9.05 4.977a.4.4 0 0 1 0 .701l-9.05 4.978a.4.4 0 0 1-.593-.35v-9.956z"/></svg>
@@ -1 +0,0 @@
1
- <svg viewBox="0 0 22 20" xmlns="http://www.w3.org/2000/svg"><path d="M1.587 1.5c-.612 0-.601-.029-.601.551v14.84c0 .59-.01.559.591.559h18.846c.602 0 .591.03.591-.56V2.052c0-.58.01-.55-.591-.55H1.587Zm.701.971h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-14.24 1h13.008v12H4.467l.029-12Zm-2.208 1h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003v1H2.288v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h1.003l-.029 1h-.974v-1Zm16.448 0h1.003v1h-1.003v-1Zm-16.448 2h.974v1h-.974v-1Zm16.448 0h1.003v1h-1.003v-1Z"/><path d="M8.374 6.648a.399.399 0 0 1 .395-.4.402.402 0 0 1 .2.049l5.148 2.824a.4.4 0 0 1 0 .7l-5.148 2.824a.403.403 0 0 1-.595-.35V6.648Z"/></svg>