From: Radek Czajka Date: Thu, 13 Jul 2023 12:21:27 +0000 (+0200) Subject: Visual: allow paragraph split inside annotations. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/73046626ddfd1cd23d0d4bdd904d1a7bae76c455?ds=inline;hp=689050858446fed8c38d8470be29f89f70cecf04 Visual: allow paragraph split inside annotations. --- diff --git a/src/redakcja/static/css/html.scss b/src/redakcja/static/css/html.scss index 881083a6..d9886d4f 100644 --- a/src/redakcja/static/css/html.scss +++ b/src/redakcja/static/css/html.scss @@ -327,6 +327,7 @@ div[x-node] > .uwaga { &.editing { display: block; + background: #93ff93; } } diff --git a/src/redakcja/static/js/wiki/caret.js b/src/redakcja/static/js/wiki/caret.js index b2cf1826..38848b09 100644 --- a/src/redakcja/static/js/wiki/caret.js +++ b/src/redakcja/static/js/wiki/caret.js @@ -151,10 +151,21 @@ class Caret { splitBlock() { let splitter = this.element; let parent, newParent, splitIndex, index; - + while (!splitter.is('div[x-node]')) { parent = splitter.parent(); splitIndex = parent.contents().index(splitter); + + if (parent.is('[x-annotation-box]')) { + // We're splitting inside an inline-style annotation. + // Convert into a block-style annotation now. + let p = $('
'); + parent.contents().appendTo(p); + parent.empty(); + parent.append(p); + parent = p; + } + newParent = parent.clone(); index = parent.contents().length - 1; while (index >= splitIndex) {