EZQMS-327: move inline comments to platform popups (#3909)

Signed-off-by: Anna No <anna.no@xored.com>
This commit is contained in:
Anna No 2023-10-30 22:38:31 +07:00 committed by GitHub
parent 2d3a751922
commit e80af41f37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -48,7 +48,7 @@
import { InlinePopupExtension } from './extension/inlinePopup'
import { InlineStyleToolbarExtension } from './extension/inlineStyleToolbar'
import { FileAttachFunction, ImageExtension } from './extension/imageExt'
import { NodeUuidExtension } from './extension/nodeUuid'
import { NodeUuidExtension, nodeElementQuerySelector } from './extension/nodeUuid'
import ImageStyleToolbar from './ImageStyleToolbar.svelte'
import StyleButton from './StyleButton.svelte'
import TextEditorStyleToolbar from './TextEditorStyleToolbar.svelte'
@ -123,6 +123,14 @@
}
}
export function getNodeElement (uuid: string): Element | null {
if (!editor || !uuid) {
return null
}
return editor.view.dom.querySelector(nodeElementQuerySelector(uuid))
}
export function selectNode (uuid: string) {
if (!editor) {
return

View File

@ -4,6 +4,8 @@ import { EditorState, Plugin, PluginKey } from 'prosemirror-state'
const NAME = 'node-uuid'
export const nodeElementQuerySelector = (nodeUuid: string): string => `span[${NAME}='${nodeUuid}']`
export interface NodeUuidOptions {
HTMLAttributes: Record<string, any>
onNodeSelected?: (uuid: string | null) => void