@ckeditor/ckeditor5-link 42.0.2 → 43.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.
package/dist/index.js CHANGED
@@ -1366,12 +1366,16 @@ const VISUAL_SELECTION_MARKER_NAME = 'link-ui';
1366
1366
  // Renders a fake visual selection marker on a collapsed selection.
1367
1367
  editor.conversion.for('editingDowncast').markerToElement({
1368
1368
  model: VISUAL_SELECTION_MARKER_NAME,
1369
- view: {
1370
- name: 'span',
1371
- classes: [
1369
+ view: (data, { writer })=>{
1370
+ if (!data.markerRange.isCollapsed) {
1371
+ return null;
1372
+ }
1373
+ const markerElement = writer.createUIElement('span');
1374
+ writer.addClass([
1372
1375
  'ck-fake-link-selection',
1373
1376
  'ck-fake-link-selection_collapsed'
1374
- ]
1377
+ ], markerElement);
1378
+ return markerElement;
1375
1379
  }
1376
1380
  });
1377
1381
  // Add the information about the keystrokes to the accessibility database.
@@ -1489,18 +1493,19 @@ const VISUAL_SELECTION_MARKER_NAME = 'link-ui';
1489
1493
  * a {@link #_balloon} attached to the selection.
1490
1494
  */ _createToolbarLinkButton() {
1491
1495
  const editor = this.editor;
1492
- const linkCommand = editor.commands.get('link');
1493
1496
  editor.ui.componentFactory.add('link', ()=>{
1494
1497
  const button = this._createButton(ButtonView);
1495
1498
  button.set({
1496
- tooltip: true,
1497
- isToggleable: true
1499
+ tooltip: true
1498
1500
  });
1499
- button.bind('isOn').to(linkCommand, 'value', (value)=>!!value);
1500
1501
  return button;
1501
1502
  });
1502
1503
  editor.ui.componentFactory.add('menuBar:link', ()=>{
1503
- return this._createButton(MenuBarMenuListItemButtonView);
1504
+ const button = this._createButton(MenuBarMenuListItemButtonView);
1505
+ button.set({
1506
+ role: 'menuitemcheckbox'
1507
+ });
1508
+ return button;
1504
1509
  });
1505
1510
  }
1506
1511
  /**
@@ -1514,9 +1519,11 @@ const VISUAL_SELECTION_MARKER_NAME = 'link-ui';
1514
1519
  view.set({
1515
1520
  label: t('Link'),
1516
1521
  icon: linkIcon,
1517
- keystroke: LINK_KEYSTROKE
1522
+ keystroke: LINK_KEYSTROKE,
1523
+ isToggleable: true
1518
1524
  });
1519
1525
  view.bind('isEnabled').to(command, 'isEnabled');
1526
+ view.bind('isOn').to(command, 'value', (value)=>!!value);
1520
1527
  // Show the panel on button click.
1521
1528
  this.listenTo(view, 'execute', ()=>this._showUI(true));
1522
1529
  return view;