@ckeditor/ckeditor5-bookmark 45.0.0-alpha.4 → 45.0.0-alpha.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-bookmark",
3
- "version": "45.0.0-alpha.4",
3
+ "version": "45.0.0-alpha.6",
4
4
  "description": "Bookmark feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,13 +13,13 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "ckeditor5": "45.0.0-alpha.4",
17
- "@ckeditor/ckeditor5-core": "45.0.0-alpha.4",
18
- "@ckeditor/ckeditor5-icons": "45.0.0-alpha.4",
19
- "@ckeditor/ckeditor5-widget": "45.0.0-alpha.4",
20
- "@ckeditor/ckeditor5-utils": "45.0.0-alpha.4",
21
- "@ckeditor/ckeditor5-ui": "45.0.0-alpha.4",
22
- "@ckeditor/ckeditor5-link": "45.0.0-alpha.4"
16
+ "ckeditor5": "45.0.0-alpha.6",
17
+ "@ckeditor/ckeditor5-core": "45.0.0-alpha.6",
18
+ "@ckeditor/ckeditor5-icons": "45.0.0-alpha.6",
19
+ "@ckeditor/ckeditor5-widget": "45.0.0-alpha.6",
20
+ "@ckeditor/ckeditor5-utils": "45.0.0-alpha.6",
21
+ "@ckeditor/ckeditor5-ui": "45.0.0-alpha.6",
22
+ "@ckeditor/ckeditor5-link": "45.0.0-alpha.6"
23
23
  },
24
24
  "author": "CKSource (http://cksource.com/)",
25
25
  "license": "SEE LICENSE IN LICENSE.md",
package/src/bookmarkui.js CHANGED
@@ -315,7 +315,13 @@ export default class BookmarkUI extends Plugin {
315
315
  emitter: this.formView,
316
316
  activator: () => this._isFormInPanel,
317
317
  contextElements: () => [this._balloon.view.element],
318
- callback: () => this._hideFormView()
318
+ callback: () => {
319
+ // Focusing on the editable during a click outside the balloon panel might
320
+ // cause the selection to move to the beginning of the editable, so we avoid
321
+ // focusing on it during this action.
322
+ // See: https://github.com/ckeditor/ckeditor5/issues/18253
323
+ this._hideFormView(false);
324
+ }
319
325
  });
320
326
  }
321
327
  /**
@@ -346,7 +352,7 @@ export default class BookmarkUI extends Plugin {
346
352
  /**
347
353
  * Removes the {@link #formView} from the {@link #_balloon}.
348
354
  */
349
- _removeFormView() {
355
+ _removeFormView(updateFocus = true) {
350
356
  // Blur the input element before removing it from DOM to prevent issues in some browsers.
351
357
  // See https://github.com/ckeditor/ckeditor5/issues/1501.
352
358
  this.formView.saveButtonView.focus();
@@ -355,7 +361,9 @@ export default class BookmarkUI extends Plugin {
355
361
  this._balloon.remove(this.formView);
356
362
  // Because the form has an input which has focus, the focus must be brought back
357
363
  // to the editor. Otherwise, it would be lost.
358
- this.editor.editing.view.focus();
364
+ if (updateFocus) {
365
+ this.editor.editing.view.focus();
366
+ }
359
367
  this._hideFakeVisualSelection();
360
368
  }
361
369
  /**
@@ -377,7 +385,7 @@ export default class BookmarkUI extends Plugin {
377
385
  /**
378
386
  * Removes the {@link #formView} from the {@link #_balloon}.
379
387
  */
380
- _hideFormView() {
388
+ _hideFormView(updateFocus = true) {
381
389
  if (!this._isFormInPanel) {
382
390
  return;
383
391
  }
@@ -386,9 +394,11 @@ export default class BookmarkUI extends Plugin {
386
394
  this.stopListening(this._balloon, 'change:visibleView');
387
395
  // Make sure the focus always gets back to the editable _before_ removing the focused form view.
388
396
  // Doing otherwise causes issues in some browsers. See https://github.com/ckeditor/ckeditor5-link/issues/193.
389
- editor.editing.view.focus();
397
+ if (updateFocus) {
398
+ editor.editing.view.focus();
399
+ }
390
400
  // Remove form first because it's on top of the stack.
391
- this._removeFormView();
401
+ this._removeFormView(updateFocus);
392
402
  this._hideFakeVisualSelection();
393
403
  }
394
404
  /**