mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-28 14:03:55 +03:00
1301 Update formatting state on selection update (#1806)
Signed-off-by: Denis Bunakalya <denis.bunakalya@xored.com>
This commit is contained in:
parent
e3ef0a0793
commit
fcea07cba5
@ -166,6 +166,11 @@
|
||||
a.action(evt?.target as HTMLElement, editorHandler)
|
||||
}
|
||||
|
||||
function updateFormattingState () {
|
||||
isBold = textEditor.checkIsActive('bold')
|
||||
isItalic = textEditor.checkIsActive('italic')
|
||||
}
|
||||
|
||||
function toggleBold () {
|
||||
textEditor.toggleBold()
|
||||
textEditor.focus()
|
||||
@ -201,6 +206,7 @@
|
||||
textEditor.clear()
|
||||
}}
|
||||
extensions={editorExtensions}
|
||||
on:selection-update={updateFormattingState}
|
||||
/>
|
||||
</div>
|
||||
{#if showSend}
|
||||
|
@ -53,6 +53,9 @@
|
||||
export function insertText (text: string): void {
|
||||
editor.commands.insertContent(text as HTMLContent)
|
||||
}
|
||||
export function checkIsActive (markName: string) {
|
||||
return editor.isActive(markName)
|
||||
}
|
||||
export function toggleBold () {
|
||||
editor.commands.toggleBold()
|
||||
}
|
||||
@ -119,7 +122,8 @@
|
||||
onUpdate: () => {
|
||||
content = editor.getHTML()
|
||||
dispatch('value', content)
|
||||
}
|
||||
},
|
||||
onSelectionUpdate: () => dispatch('selection-update')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user