This commit is contained in:
the-djmaze 2024-01-30 19:16:53 +01:00
parent 9eb5646aec
commit a352ebff25
40 changed files with 102 additions and 46 deletions

View file

@ -270,6 +270,13 @@ class SquireUI
btn.classList.toggle('active', 'source' == this.mode);
}
}
},
clear: {
removeStyle: {
html: '⎚',
cmd: () => squire.setStyle()
}
}
},

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "العام",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Общи",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Všeobecné",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Generelt",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Bild URL",
"IMAGEUPLOAD": "Bilddatei auswählen",
"UNDO": "Rückgängig",
"REDO": "Wiederholen"
"REDO": "Wiederholen",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Allgemein",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Γενικό",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "General",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "General",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "General",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Üldine",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Orokorra",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "عمومی",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Yleinen",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "URL de l'image",
"IMAGEUPLOAD": "Sélection de l'image",
"UNDO": "Annuler",
"REDO": "Refaire"
"REDO": "Refaire",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Général",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Általános",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Umum",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Almennt",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Generali",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "全般",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "일반",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Pagrindiniai",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Vispārējie",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Generelt",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Afbeelding URL",
"IMAGEUPLOAD": "Upload afbeelding",
"UNDO": "Ongedaan maken",
"REDO": "Opnieuw"
"REDO": "Opnieuw",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Algemeen",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Odnośnik obrazu",
"IMAGEUPLOAD": "Wybierz obraz",
"UNDO": "Cofnij",
"REDO": "Ponów"
"REDO": "Ponów",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Ogólne",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Geral",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Imagem por URL",
"IMAGEUPLOAD": "Escolher imagem",
"UNDO": "Desfazer",
"REDO": "Refazer"
"REDO": "Refazer",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Geral",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Imagem por URL",
"IMAGEUPLOAD": "Escolher imagem",
"UNDO": "Desfazer",
"REDO": "Refazer"
"REDO": "Refazer",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Geral",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "De bază",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Основные",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Všeobecné",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Splošno",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Allmänt",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Genel",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "Основні",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "Image URL",
"IMAGEUPLOAD": "Image select",
"UNDO": "Undo",
"REDO": "Redo"
"REDO": "Redo",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "General",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "图片 URL",
"IMAGEUPLOAD": "选择图片",
"UNDO": "撤销",
"REDO": "重做"
"REDO": "重做",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "常规",

View file

@ -386,7 +386,8 @@
"IMAGEURL": "圖片 URL",
"IMAGEUPLOAD": "圖片選取",
"UNDO": "復原",
"REDO": "取消復原"
"REDO": "取消復原",
"REMOVESTYLE": "Remove style"
},
"SETTINGS_LABELS": {
"GENERAL": "一般設定",

View file

@ -1808,12 +1808,12 @@ const
setAttributes = (node, props) => {
props && Object.entries(props).forEach(([k,v]) => {
if ("style" === k && typeof v === "object") {
Object.entries(v).forEach(([k,v]) => node.style[k] = v);
} else if (v != null) {
node.setAttribute(k, v);
} else {
if (null == v) {
node.removeAttribute(k);
} else if ("style" === k && typeof v === "object") {
Object.entries(v).forEach(([k,v]) => node.style[k] = v);
} else {
node.setAttribute(k, v);
}
});
},
@ -2262,7 +2262,7 @@ class Squire
},
formatRemove: event => {
event.preventDefault();
this.setStyle(null);
this.setStyle();
},
formatSetBlockTextDirection: event => {
event.preventDefault();
@ -3665,9 +3665,20 @@ class Squire
let end = range ? range.endContainer : 0;
// When the selection is all the text inside an element, set style on the element itself
if ("dir" == name || (isTextNode(start) && 0 === range.startOffset && start === end && end.length === range.endOffset)) {
this.saveUndoState(range);
this._recordUndoState(range);
setAttributes(start.parentNode, {[name]: value});
this.setRange(range);
// this.setRange(range);
this._docWasChanged();
}
// Else when it should remove the attribute
else if (null == value) {
this._recordUndoState(range);
let node = getClosest(range.commonAncestorContainer, this._root, '*');
range.collapsed
? setAttributes(node, {[name]: value})
: node.querySelectorAll('*').forEach(el => setAttributes(el, {[name]: value}));
// this.setRange(range);
this._docWasChanged();
}
// Else create a span element
else {