mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
Fix field description not toggled properly (#1919)
It appears that a variable bound to the `innerHTML` property of a contenteditable element is only updated when `input` event fires on the element, and not when changes are made to the DOM programmatically.
This commit is contained in:
parent
3969487e77
commit
bc5633e070
2 changed files with 3 additions and 4 deletions
|
@ -39,14 +39,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
const description = getContext<Readable<string>>(descriptionKey);
|
||||
$: descriptionCSSValue = `"${$description}"`;
|
||||
|
||||
let innerHTML = "";
|
||||
$: empty = ["", "<br>"].includes(innerHTML);
|
||||
export let content: Writable<string>;
|
||||
</script>
|
||||
|
||||
<anki-editable
|
||||
class:empty
|
||||
class:empty={!$content}
|
||||
contenteditable="true"
|
||||
bind:innerHTML
|
||||
use:resolve
|
||||
use:setupFocusHandling
|
||||
use:preventBuiltinShortcuts
|
||||
|
|
|
@ -148,6 +148,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
mirrors: [mirror],
|
||||
inputHandlers: [setupInputHandler, setupGlobalInputHandler],
|
||||
api: api.editable,
|
||||
content,
|
||||
},
|
||||
context: allContexts,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue