mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-22 08:20:39 +00: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)
|
a.action(evt?.target as HTMLElement, editorHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateFormattingState () {
|
||||||
|
isBold = textEditor.checkIsActive('bold')
|
||||||
|
isItalic = textEditor.checkIsActive('italic')
|
||||||
|
}
|
||||||
|
|
||||||
function toggleBold () {
|
function toggleBold () {
|
||||||
textEditor.toggleBold()
|
textEditor.toggleBold()
|
||||||
textEditor.focus()
|
textEditor.focus()
|
||||||
@ -201,6 +206,7 @@
|
|||||||
textEditor.clear()
|
textEditor.clear()
|
||||||
}}
|
}}
|
||||||
extensions={editorExtensions}
|
extensions={editorExtensions}
|
||||||
|
on:selection-update={updateFormattingState}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if showSend}
|
{#if showSend}
|
||||||
|
@ -53,6 +53,9 @@
|
|||||||
export function insertText (text: string): void {
|
export function insertText (text: string): void {
|
||||||
editor.commands.insertContent(text as HTMLContent)
|
editor.commands.insertContent(text as HTMLContent)
|
||||||
}
|
}
|
||||||
|
export function checkIsActive (markName: string) {
|
||||||
|
return editor.isActive(markName)
|
||||||
|
}
|
||||||
export function toggleBold () {
|
export function toggleBold () {
|
||||||
editor.commands.toggleBold()
|
editor.commands.toggleBold()
|
||||||
}
|
}
|
||||||
@ -119,7 +122,8 @@
|
|||||||
onUpdate: () => {
|
onUpdate: () => {
|
||||||
content = editor.getHTML()
|
content = editor.getHTML()
|
||||||
dispatch('value', content)
|
dispatch('value', content)
|
||||||
}
|
},
|
||||||
|
onSelectionUpdate: () => dispatch('selection-update')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user