aasd
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.1.53
|
1.1.54
|
||||||
@@ -502,6 +502,54 @@
|
|||||||
saveSelection();
|
saveSelection();
|
||||||
} catch {}
|
} catch {}
|
||||||
};
|
};
|
||||||
|
const removeInlineFormatting = () => {
|
||||||
|
try {
|
||||||
|
content.focus();
|
||||||
|
restoreSelection();
|
||||||
|
const docRef = content.ownerDocument || document;
|
||||||
|
const range = getSelectionRange();
|
||||||
|
if (!range || range.collapsed) return;
|
||||||
|
const fragment = range.extractContents();
|
||||||
|
const unwrap = (node) => {
|
||||||
|
const parent = node.parentNode;
|
||||||
|
if (!parent) return;
|
||||||
|
while (node.firstChild) parent.insertBefore(node.firstChild, node);
|
||||||
|
parent.removeChild(node);
|
||||||
|
};
|
||||||
|
const strip = (node) => {
|
||||||
|
if (!node) return;
|
||||||
|
if (node.nodeType === 1) {
|
||||||
|
const tag = node.tagName ? node.tagName.toUpperCase() : '';
|
||||||
|
if (tag === 'B' || tag === 'STRONG' || tag === 'I' || tag === 'EM' || tag === 'U' || tag === 'S' || tag === 'STRIKE') {
|
||||||
|
const children = Array.from(node.childNodes);
|
||||||
|
children.forEach(strip);
|
||||||
|
unwrap(node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (tag === 'SPAN') {
|
||||||
|
try {
|
||||||
|
node.style.fontWeight = '';
|
||||||
|
node.style.fontStyle = '';
|
||||||
|
node.style.textDecoration = '';
|
||||||
|
node.style.textDecorationLine = '';
|
||||||
|
node.style.textDecorationStyle = '';
|
||||||
|
} catch {}
|
||||||
|
const styleAttr = node.getAttribute('style');
|
||||||
|
if (!styleAttr || !String(styleAttr).trim()) {
|
||||||
|
const children = Array.from(node.childNodes);
|
||||||
|
children.forEach(strip);
|
||||||
|
unwrap(node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Array.from(node.childNodes).forEach(strip);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Array.from(fragment.childNodes).forEach(strip);
|
||||||
|
range.insertNode(fragment);
|
||||||
|
saveSelection();
|
||||||
|
} catch {}
|
||||||
|
};
|
||||||
|
|
||||||
const addButton = (labelHtml, title, cmd, valueGetter, handler) => {
|
const addButton = (labelHtml, title, cmd, valueGetter, handler) => {
|
||||||
const btn = doc.createElement('button');
|
const btn = doc.createElement('button');
|
||||||
@@ -653,7 +701,16 @@
|
|||||||
addButton(icon('M7 6h10v2H7zM9 10h6v2H9zM8 14h8v2H8z'), 'Hochgestellt', 'superscript');
|
addButton(icon('M7 6h10v2H7zM9 10h6v2H9zM8 14h8v2H8z'), 'Hochgestellt', 'superscript');
|
||||||
addButton(icon('M7 4h4v4H7V4zm6 12h4v4h-4v-4zM7 10h10v2H7v-2z'), 'Einzug', 'indent');
|
addButton(icon('M7 4h4v4H7V4zm6 12h4v4h-4v-4zM7 10h10v2H7v-2z'), 'Einzug', 'indent');
|
||||||
addButton(icon('M13 4h4v4h-4V4zM7 16h4v4H7v-4zM7 10h10v2H7v-2z'), 'Ausruecken', 'outdent');
|
addButton(icon('M13 4h4v4h-4V4zM7 16h4v4H7v-4zM7 10h10v2H7v-2z'), 'Ausruecken', 'outdent');
|
||||||
addButton(icon('M5 5h14v2H5zM5 9h10v2H5zM5 13h14v2H5zM5 17h10v2H5z'), 'Formatierung entfernen', 'removeFormat');
|
addButton(
|
||||||
|
icon('M5 5h14v2H5zM5 9h10v2H5zM5 13h14v2H5zM5 17h10v2H5z'),
|
||||||
|
'Formatierung entfernen',
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
() => {
|
||||||
|
exec('removeFormat');
|
||||||
|
removeInlineFormatting();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const fontOptions = (this.B.RTE_FONTS && Array.isArray(this.B.RTE_FONTS) && this.B.RTE_FONTS.length)
|
const fontOptions = (this.B.RTE_FONTS && Array.isArray(this.B.RTE_FONTS) && this.B.RTE_FONTS.length)
|
||||||
? this.B.RTE_FONTS
|
? this.B.RTE_FONTS
|
||||||
|
|||||||
Reference in New Issue
Block a user