Prevent cross-contamination of SimpleMDE auto-saves

This commit is contained in:
Simon Brooke 2018-07-18 23:01:14 +01:00
parent 80860a264e
commit 1be3db1453
2 changed files with 24 additions and 18 deletions

View file

@ -1,17 +1,22 @@
var simplemde = new SimpleMDE({ /**
autosave: { * Provide SimpleMDE support for textareas on this page. TODO: this is
enabled: true, * slightly problematic since it assumes (and saves autosave data for)
uniqueId: "adl-generated-{{page}}", * only one text area on the page. Perhaps we should disable autosave?
delay: 1000, */
}, var simplemde = new SimpleMDE({
indentWithTabs: true, autosave: {
insertTexts: { enabled: true,
horizontalRule: ["", "\n\n-----\n\n"], uniqueId: "{{page}}-{{record.id}}",
image: ["![](http://", ")"], delay: 1000,
link: ["[", "](http://)"], },
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"], indentWithTabs: true,
}, insertTexts: {
showIcons: ["code"], //, "table"], - sadly, markdown-clj does not support tables horizontalRule: ["", "\n\n-----\n\n"],
spellChecker: true, image: ["![](http://", ")"],
status: ["autosave", "lines", "words", "cursor"] link: ["[", "](http://)"],
}); table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
},
showIcons: ["code"], //, "table"], - sadly, markdown-clj does not support tables
spellChecker: true,
status: ["autosave", "lines", "words", "cursor"]
});

View file

@ -635,7 +635,8 @@
(child-with-tag (child-with-tag
form :field form :field
#(= "text-area" (widget-type (property-for-field % entity) application))) #(= "text-area" (widget-type (property-for-field % entity) application)))
(embed-script-fragment "resources/js/text-area-md-support.js"))))))}}) (embed-script-fragment "resources/js/text-area-md-support.js"
[["{{page}}" (-> form :attrs :name)]]))))))}})
(defn form-to-template (defn form-to-template