mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-12 09:20:45 +08:00
Merge pull request #8815 from andrej-scinote/aj_SCI_12192
[DRAFT] Add nested lists for TinyMCE fields [SCI-11979]
This commit is contained in:
commit
c37bca24af
6 changed files with 59 additions and 3 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
@import "tailwind/radio";
|
@import "tailwind/radio";
|
||||||
@import "tailwind/loader.css";
|
@import "tailwind/loader.css";
|
||||||
@import "tailwind/tags.css";
|
@import "tailwind/tags.css";
|
||||||
|
@import "tailwind/lists.css";
|
||||||
|
|
||||||
@tailwind base;
|
@tailwind base;
|
||||||
@tailwind components;
|
@tailwind components;
|
||||||
|
|
|
||||||
14
app/assets/stylesheets/tailwind/lists.css
Normal file
14
app/assets/stylesheets/tailwind/lists.css
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
@layer components {
|
||||||
|
.numerical-nested-list ol:not([style*="list-style-type"]) {
|
||||||
|
counter-reset: item;
|
||||||
|
}
|
||||||
|
|
||||||
|
.numerical-nested-list ol:not([style*="list-style-type"]) li {
|
||||||
|
@apply block
|
||||||
|
}
|
||||||
|
|
||||||
|
.numerical-nested-list ol:not([style*="list-style-type"]) li::before {
|
||||||
|
content: counters(item, ".") ". ";
|
||||||
|
counter-increment: item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -21,6 +21,19 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ol:not([style*="list-style-type"]) {
|
||||||
|
counter-reset: item;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol:not([style*="list-style-type"]) li {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol:not([style*="list-style-type"]) li:before {
|
||||||
|
content: counters(item, ".") ". ";
|
||||||
|
counter-increment: item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mce-tinymce {
|
.mce-tinymce {
|
||||||
|
|
|
||||||
16
app/javascript/packs/tiny_mce.js
vendored
16
app/javascript/packs/tiny_mce.js
vendored
|
|
@ -42,7 +42,21 @@ import contentUiCss from '!!raw-loader!tinymce/skins/ui/tinymce-5/content.min.cs
|
||||||
|
|
||||||
const contentPStyle = `p { margin: 0; padding: 0;}`;
|
const contentPStyle = `p { margin: 0; padding: 0;}`;
|
||||||
const contentBodyStyle = `body { font-family: "SN Inter", "Open Sans", Arial, Helvetica, sans-serif }`;
|
const contentBodyStyle = `body { font-family: "SN Inter", "Open Sans", Arial, Helvetica, sans-serif }`;
|
||||||
const contentStyle = [contentCss, contentUiCss, contentBodyStyle, contentPStyle].map((s) => s.toString()).join('\n');
|
const contentListStyle = `
|
||||||
|
ol:not([style*="list-style-type"]) {
|
||||||
|
counter-reset: item;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol:not([style*="list-style-type"]) li {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol:not([style*="list-style-type"]) li:before {
|
||||||
|
content: counters(item, ".") ". ";
|
||||||
|
counter-increment: item;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
const contentStyle = [contentCss, contentUiCss, contentBodyStyle, contentPStyle, contentListStyle].map((s) => s.toString()).join('\n');
|
||||||
|
|
||||||
// Optional pre-initialization method
|
// Optional pre-initialization method
|
||||||
if (typeof(window.preTinyMceInit) === 'function') {
|
if (typeof(window.preTinyMceInit) === 'function') {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
textareaId="descriptionModelInput"
|
textareaId="descriptionModelInput"
|
||||||
></TinymceEditor>
|
></TinymceEditor>
|
||||||
</div>
|
</div>
|
||||||
<span v-else v-html="description"></span>
|
<span v-else v-html="description" class="numerical-nested-list"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button v-if="editMode" type="button" @click="cancelEdit" class="btn btn-secondary">{{ i18n.t('general.cancel') }}</button>
|
<button v-if="editMode" type="button" @click="cancelEdit" class="btn btn-secondary">{{ i18n.t('general.cancel') }}</button>
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,21 @@ import contentUiCss from '!!raw-loader!tinymce/skins/ui/tinymce-5/content.min.cs
|
||||||
|
|
||||||
const contentPStyle = 'p { margin: 0; padding: 0;}';
|
const contentPStyle = 'p { margin: 0; padding: 0;}';
|
||||||
const contentBodyStyle = 'body { font-family: "SN Inter", "Open Sans", Arial, Helvetica, sans-serif }';
|
const contentBodyStyle = 'body { font-family: "SN Inter", "Open Sans", Arial, Helvetica, sans-serif }';
|
||||||
const contentStyle = [contentCss, contentUiCss, contentBodyStyle, contentPStyle].map((s) => s.toString()).join('\n');
|
const contentListStyle = `
|
||||||
|
ol:not([style*="list-style-type"]) {
|
||||||
|
counter-reset: item;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol:not([style*="list-style-type"]) li {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
ol:not([style*="list-style-type"]) li:before {
|
||||||
|
content: counters(item, ".") ". ";
|
||||||
|
counter-increment: item;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
const contentStyle = [contentCss, contentUiCss, contentBodyStyle, contentPStyle, contentListStyle].map((s) => s.toString()).join('\n');
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TinemcyEditor',
|
name: 'TinemcyEditor',
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue