mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 16:56:22 +00:00
olvidar el artículo al guardar
This commit is contained in:
parent
de5c1864c3
commit
9cb3c084ee
1 changed files with 15 additions and 2 deletions
|
@ -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 { isDirectChild, moveChildren, safeGetSelection, safeGetRangeAt, setAuxiliaryToolbar, parentBlockNames } from 'editor/utils'
|
||||||
import { types, getValidChildren, getType } from 'editor/types'
|
import { types, getValidChildren, getType } from 'editor/types'
|
||||||
import { setupButtons as setupMarksButtons } from 'editor/types/marks'
|
import { setupButtons as setupMarksButtons } from 'editor/types/marks'
|
||||||
|
@ -279,11 +279,24 @@ function setupEditor (editorEl: HTMLElement): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("turbolinks:load", () => {
|
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]')) {
|
for (const editorEl of document.querySelectorAll<HTMLElement>('.editor[data-editor]')) {
|
||||||
try {
|
try {
|
||||||
setupEditor(editorEl)
|
setupEditor(editorEl)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//alert(`No pude iniciar el editor: ${error}`)
|
|
||||||
// TODO: mostrar error
|
// TODO: mostrar error
|
||||||
console.error('no se pudo iniciar el editor, error completo', error)
|
console.error('no se pudo iniciar el editor, error completo', error)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue