We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nodeElement
protyleSlash.callback
目前 slash 命令的 callback 函数仅仅传入一个 protyle 对象。但是对 slash 而言更重要的是获取当前所在的块。
interface IPluginProtyleSlash { filter: string[]; html: string; id: string; callback(protyle: Protyle): void; }
目前我是通过绕路的方法,拿到当前所在的 node 节点
const selection = window.getSelection(); const focusNode: Node = selection?.focusNode; if (!focusNode) { showMessage(`Failed, can't find focus node`, 5000, 'error'); return; } let ele: HTMLElement = focusNode.nodeType === Node.TEXT_NODE ? focusNode.parentElement : focusNode as HTMLElement; ele = ele.closest('[data-node-id]') as HTMLElement;
但是每次这么弄实在有些麻烦。希望可以增加传入的一些参数,能直接获取所在块的信息。
为 callback 添加参数,比如直接传入所在的 Node 节点的 HTMLElement(如果能额外传入 block 对象就更好了,不然还需要使用 async 函数查询对应的块)
callback
No response
The text was updated successfully, but these errors were encountered:
🎨 siyuan-note/siyuan#14036
310bd5c
6aa99c1
🎨 #14036
e76d008
Vanessa219
No branches or pull requests
In what scenarios do you need this feature?
目前 slash 命令的 callback 函数仅仅传入一个 protyle 对象。但是对 slash 而言更重要的是获取当前所在的块。
目前我是通过绕路的方法,拿到当前所在的 node 节点
但是每次这么弄实在有些麻烦。希望可以增加传入的一些参数,能直接获取所在块的信息。
Describe the optimal solution
为
callback
添加参数,比如直接传入所在的 Node 节点的 HTMLElement(如果能额外传入 block 对象就更好了,不然还需要使用 async 函数查询对应的块)Describe the candidate solution
No response
Other information
No response
The text was updated successfully, but these errors were encountered: