5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-07 09:25:46 +00:00

olvidar el artículo al guardar

This commit is contained in:
f 2021-02-26 10:21:53 -03:00
parent de5c1864c3
commit 9cb3c084ee

View file

@ -1,4 +1,4 @@
import { storeContent, restoreContent } from 'editor/storage'
import { storeContent, restoreContent, forgetContent } from 'editor/storage'
import { isDirectChild, moveChildren, safeGetSelection, safeGetRangeAt, setAuxiliaryToolbar, parentBlockNames } from 'editor/utils'
import { types, getValidChildren, getType } from 'editor/types'
import { setupButtons as setupMarksButtons } from 'editor/types/marks'
@ -279,11 +279,24 @@ function setupEditor (editorEl: HTMLElement): void {
}
document.addEventListener("turbolinks:load", () => {
const flash = document.querySelector<HTMLElement>('.js-flash')
if (flash) {
const keys = JSON.parse(flash.dataset.keys || '')
switch (flash.dataset.target) {
case 'editor':
switch (flash.dataset.action) {
case 'forget-content':
keys.forEach(forgetContent)
}
}
}
for (const editorEl of document.querySelectorAll<HTMLElement>('.editor[data-editor]')) {
try {
setupEditor(editorEl)
} catch (error) {
//alert(`No pude iniciar el editor: ${error}`)
// TODO: mostrar error
console.error('no se pudo iniciar el editor, error completo', error)
}