mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Added strike, sup and sub marks
This commit is contained in:
@ -13,6 +13,21 @@ marks.underline = {
|
|||||||
close: '</span>',
|
close: '</span>',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
marks.strike = {
|
||||||
|
open: '<span style="text-decoration: line-through;">',
|
||||||
|
close: '</span>',
|
||||||
|
};
|
||||||
|
|
||||||
|
marks.superscript = {
|
||||||
|
open: '<sup>',
|
||||||
|
close: '</sup>',
|
||||||
|
};
|
||||||
|
|
||||||
|
marks.subscript = {
|
||||||
|
open: '<sub>',
|
||||||
|
close: '</sub>',
|
||||||
|
};
|
||||||
|
|
||||||
function writeNodeAsHtml(state, node) {
|
function writeNodeAsHtml(state, node) {
|
||||||
const html = docToHtml({ content: [node] });
|
const html = docToHtml({ content: [node] });
|
||||||
state.write(html);
|
state.write(html);
|
||||||
|
@ -56,6 +56,9 @@ const inlineStyles = [
|
|||||||
markItem(schema.marks.strong, {title: "Bold", icon: icons.strong}),
|
markItem(schema.marks.strong, {title: "Bold", icon: icons.strong}),
|
||||||
markItem(schema.marks.em, {title: "Italic", icon: icons.em}),
|
markItem(schema.marks.em, {title: "Italic", icon: icons.em}),
|
||||||
markItem(schema.marks.underline, {title: "Underline", label: 'U'}),
|
markItem(schema.marks.underline, {title: "Underline", label: 'U'}),
|
||||||
|
markItem(schema.marks.strike, {title: "Strikethrough", label: '-S-'}),
|
||||||
|
markItem(schema.marks.superscript, {title: "Superscript", label: 'sup'}),
|
||||||
|
markItem(schema.marks.subscript, {title: "Subscript", label: 'sub'}),
|
||||||
];
|
];
|
||||||
|
|
||||||
const formats = [
|
const formats = [
|
||||||
|
@ -30,7 +30,28 @@ const markUnderline = {
|
|||||||
toDOM() {
|
toDOM() {
|
||||||
return ["span", {style: "text-decoration: underline;"}, 0];
|
return ["span", {style: "text-decoration: underline;"}, 0];
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
const markStrike = {
|
||||||
|
parseDOM: [{tag: "s"}, {tag: "strike"}, {style: "text-decoration=line-through"}],
|
||||||
|
toDOM() {
|
||||||
|
return ["span", {style: "text-decoration: line-through;"}, 0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const markSuperscript = {
|
||||||
|
parseDOM: [{tag: "sup"}],
|
||||||
|
toDOM() {
|
||||||
|
return ["sup", 0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const markSubscript = {
|
||||||
|
parseDOM: [{tag: "sub"}],
|
||||||
|
toDOM() {
|
||||||
|
return ["sub", 0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const customNodes = baseNodes.append({
|
const customNodes = baseNodes.append({
|
||||||
callout: nodeCallout,
|
callout: nodeCallout,
|
||||||
@ -38,6 +59,9 @@ const customNodes = baseNodes.append({
|
|||||||
|
|
||||||
const customMarks = baseMarks.append({
|
const customMarks = baseMarks.append({
|
||||||
underline: markUnderline,
|
underline: markUnderline,
|
||||||
|
strike: markStrike,
|
||||||
|
superscript: markSuperscript,
|
||||||
|
subscript: markSubscript,
|
||||||
});
|
});
|
||||||
|
|
||||||
const schema = new Schema({
|
const schema = new Schema({
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
<h2>This is an editable block</h2>
|
<h2>This is an editable block</h2>
|
||||||
<p>
|
<p>
|
||||||
Lorem ipsum dolor sit amet, <strong>consectetur adipisicing</strong> elit. Asperiores? <br>
|
Lorem ipsum dolor sit amet, <strong>consectetur adipisicing</strong> elit. Asperiores? <br>
|
||||||
Some <span style="text-decoration: underline">Underlined content</span> Lorem ipsum dolor sit amet.
|
Some <span style="text-decoration: underline">Underlined content</span> Lorem ipsum dolor sit amet. <br>
|
||||||
|
Some <span style="text-decoration: line-through;">striked content</span> Lorem ipsum dolor sit amet. <br>
|
||||||
</p>
|
</p>
|
||||||
<p><img src="/user_avatar.png" alt="Logo"></p>
|
<p><img src="/user_avatar.png" alt="Logo"></p>
|
||||||
<ul>
|
<ul>
|
||||||
|
Reference in New Issue
Block a user