Skip to content

Build your personal knowledge base with Trilium Notes

client/text editor/block drag handle: tweak

Adorian Doran6fb0decc04c3
diff --git a/apps/client/src/stylesheets/theme-next/notes/text.css b/apps/client/src/stylesheets/theme-next/notes/text.css
index 4081efd7a5..9da19e0006 100644
--- a/apps/client/src/stylesheets/theme-next/notes/text.css
+++ b/apps/client/src/stylesheets/theme-next/notes/text.css
@@ -62,6 +62,10 @@
z-index: 1600;
}
+:root .ck.block-drag-handle:not(:hover) {
+ color: var(--main-border-color);
+}
+
:root .ck.ck-toolbar .ck-button:not(.ck-disabled):active {
background-color: var(--hover-item-background-color);
}
diff --git a/packages/ckeditor5/src/plugins/block_drag_handle.spec.ts b/packages/ckeditor5/src/plugins/block_drag_handle.spec.ts
index 985ab27ffa..4c23e8fc64 100644
--- a/packages/ckeditor5/src/plugins/block_drag_handle.spec.ts
+++ b/packages/ckeditor5/src/plugins/block_drag_handle.spec.ts
@@ -27,6 +27,8 @@ describe("BlockDragHandle", () => {
const buttonView = editor.plugins.get(BlockDragHandle).buttonView;
expect(buttonView?.isVisible).toBe(true);
expect(button.getAttribute("draggable")).toBe("true");
+ expect(button.classList).toContain("block-drag-handle");
+ expect(getComputedStyle(button).cursor).toBe("grab");
expect(isBesideBlock(editor, button, 1)).toBe(true);
button.focus();
diff --git a/packages/ckeditor5/src/plugins/block_drag_handle.ts b/packages/ckeditor5/src/plugins/block_drag_handle.ts
index 168e93167f..3e30089f3b 100644
--- a/packages/ckeditor5/src/plugins/block_drag_handle.ts
+++ b/packages/ckeditor5/src/plugins/block_drag_handle.ts
@@ -46,7 +46,7 @@ export default class BlockDragHandle extends Plugin {
isToggleable: false
});
buttonView.extendTemplate({
- attributes: { draggable: "true" },
+ attributes: { class: "block-drag-handle", draggable: "true" },
on: {
dragstart: buttonView.bindTemplate.to((domEvent) => {
this.startDrag(domEvent as DragEvent);
diff --git a/packages/ckeditor5/src/theme/block_drag_handle.css b/packages/ckeditor5/src/theme/block_drag_handle.css
index 1965a4501f..bf8750aea7 100644
--- a/packages/ckeditor5/src/theme/block_drag_handle.css
+++ b/packages/ckeditor5/src/theme/block_drag_handle.css
@@ -3,6 +3,14 @@
color-mix(in srgb, var(--main-text-color, var(--ck-color-text)) 6%, transparent);
}
+.ck.ck-button.block-drag-handle {
+ cursor: grab;
+
+ &:active {
+ cursor: grabbing;
+ }
+}
+
.ck-editor__editable .block-drag-handle-target {
box-shadow: inset 0 0 0 100vmax var(--block-drag-handle-target-background);
}