Fix: make sure Edit buttons work even for Lua expressions and code
widgets whose bodies appear multiple times in the same page (previously always jumped to first).
This commit is contained in:
@@ -10,7 +10,7 @@ import { extendedMarkdownLanguage } from "../markdown_parser/parser.ts";
|
||||
import { renderToText } from "@silverbulletmd/silverbullet/lib/tree";
|
||||
import {
|
||||
attachWidgetEventHandlers,
|
||||
moveCursorIntoText,
|
||||
moveCursorToWidgetStart,
|
||||
} from "./widget_util.ts";
|
||||
import { expandMarkdown } from "../markdown_renderer/inline.ts";
|
||||
import {
|
||||
@@ -366,7 +366,11 @@ export class LuaWidget extends WidgetType {
|
||||
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>',
|
||||
listener: (e) => {
|
||||
e.stopPropagation();
|
||||
moveCursorIntoText(this.opts.client, this.opts.codeText!);
|
||||
moveCursorToWidgetStart(
|
||||
this.opts.client,
|
||||
this.dom!,
|
||||
this.opts.codeText,
|
||||
);
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user