8
0
Pārlūkot izejas kodu

Link highlighting WIP.

Szymon Kupś 7 gadi atpakaļ
vecāks
revīzija
c744d2e323
1 mainītis faili ar 19 papildinājumiem un 0 dzēšanām
  1. 19 0
      packages/ckeditor5-link/src/linkediting.js

+ 19 - 0
packages/ckeditor5-link/src/linkediting.js

@@ -16,6 +16,8 @@ import { createLinkElement } from './utils';
 import bindTwoStepCaretToAttribute from '@ckeditor/ckeditor5-engine/src/utils/bindtwostepcarettoattribute';
 import findLinkRange from './findlinkrange';
 import '../theme/link.css';
+import DocumentSelection from '@ckeditor/ckeditor5-engine/src/model/documentselection';
+import ModelSelection from '@ckeditor/ckeditor5-engine/src/model/selection';
 
 /**
  * The link engine feature.
@@ -82,6 +84,23 @@ export default class LinkEditing extends Plugin {
 				}
 			} ) );
 
+		// editor.editing.downcastDispatcher.on( 'attribute:linkHref', ( evt, data, conversionApi ) => {
+		// 	if ( !( data.item instanceof DocumentSelection || data.item instanceof ModelSelection ) ) {
+		// 		return;
+		// 	}
+		//
+		// 	const selection = data.item;
+		//
+		// 	if ( !selection.isCollapsed ) {
+		// 		return;
+		// 	}
+		//
+		// 	const writer = conversionApi.writer;
+		// 	const viewSelection = writer.document.selection;
+		// 	const wrapper = writer.createAttributeElement( 'span', { class: 'ck-link_selected' }, 1 );
+		// 	conversionApi.writer.wrap( viewSelection.getFirstRange(), wrapper );
+		// }, { priority: 'lowest' } );
+
 		doc.on( 'change', () => {
 			const selection = doc.selection;