focus and placeholder for ProseMirrorEditor

master
Niko PLP 1 month ago
parent 74137c4bdd
commit 0a5c03ebd1
  1. 7
      ng-app/src/apps/ProseMirrorEditor.svelte
  2. 1
      ng-app/src/apps/ProseMirrorViewer.svelte
  3. 1
      ng-app/src/locales/en.json

@ -24,6 +24,7 @@
cur_tab_deregister_on_save,
cur_tab_branch_class
} from "../tab";
import { t } from "svelte-i18n";
import * as Y from 'yjs'
// @ts-ignore
@ -38,6 +39,8 @@
const ydoc = new Y.Doc()
const yxml = ydoc.getXmlFragment('ng')
let view;
ydoc.on('update', async (update, origin) => {
console.log(update,origin);
if (!origin.local) {
@ -82,6 +85,8 @@
for (const h of history) {
Y.applyUpdate(ydoc, h.YXml, {local:true})
}
view.focus()
});
onDestroy(()=>{
@ -94,6 +99,8 @@
className="prosemirror-editor"
{editorState}
debounceChangeEventsInterval=2000
placeholder={$t("doc.type_your_text_here")}
bind:view={view}
/>
</div>

@ -68,6 +68,7 @@
</script>
<div class="grow p-5">
{#if source}
<div class="post-rich-text">

@ -44,6 +44,7 @@
"view_graph": "View Graph",
"results": "Results",
"empty": "Empty",
"type_your_text_here": "Type your text here",
"sparql_update": "SPARQL Update",
"no_triples": "No triples in this Graph.",
"start_editing": "Start editing",

Loading…
Cancel
Save