Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
link previews: add selection handle to card and video link previews
Adorian Doran8bc90b8c0671
diff --git a/packages/ckeditor5/src/plugins/linkembed.spec.ts b/packages/ckeditor5/src/plugins/linkembed.spec.tsindex 3203add198..b72d56b8d2 100644--- a/packages/ckeditor5/src/plugins/linkembed.spec.ts+++ b/packages/ckeditor5/src/plugins/linkembed.spec.ts@@ -211,6 +211,9 @@ describe("LinkEmbed", () => {const view = getViewData(editor.editing.view);expect(view).toContain("link-embed");expect(view).toContain("ck-widget");+ // The block preview carries CKEditor's own drag handle (as tables do), so the whole widget+ // moves as one instead of the user tearing its image and text apart.+ expect(view).toContain("ck-widget_with-selection-handle");expect(renderLinkEmbed).toHaveBeenCalled();const [container, metadata, editable] = renderLinkEmbed.mock.calls[0];diff --git a/packages/ckeditor5/src/plugins/linkembed.ts b/packages/ckeditor5/src/plugins/linkembed.tsindex 9f6a18471a..132615a0ad 100644--- a/packages/ckeditor5/src/plugins/linkembed.ts+++ b/packages/ckeditor5/src/plugins/linkembed.ts@@ -306,7 +306,11 @@ class LinkEmbedEditing extends Plugin {});writer.insert(writer.createPositionAt(section, 0), preview);- return toWidget(section, writer, { label: 'link embed widget' });+ // hasSelectionHandle gives the block preview (both card and video) CKEditor's own+ // widget drag handle — the same one tables use. Without a handle the user grabs the+ // preview's own content and the browser's native drag tears the image and text apart;+ // the handle moves the whole widget atomically instead.+ return toWidget(section, writer, { label: 'link embed widget', hasSelectionHandle: true });}});