mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 11:09:20 +03:00
Cleanup Squire and Knockout with help of Chromium Code Coverage
Bugfix: Squire inlineNodeNames the 'I' tag was missing Improved: Squire style editing
This commit is contained in:
parent
0158a5fe1e
commit
fac36e828b
9 changed files with 2820 additions and 3034 deletions
44
dev/External/SquireUI.js
vendored
44
dev/External/SquireUI.js
vendored
|
|
@ -26,28 +26,10 @@ const
|
|||
SquireDefaultConfig = {
|
||||
/*
|
||||
blockTag: 'P',
|
||||
blockAttributes: null,
|
||||
tagAttributes: {
|
||||
blockquote: null,
|
||||
ul: null,
|
||||
ol: null,
|
||||
li: null,
|
||||
a: null
|
||||
},
|
||||
classNames: {
|
||||
colour: 'colour',
|
||||
fontFamily: 'font',
|
||||
fontSize: 'size',
|
||||
highlight: 'highlight'
|
||||
},
|
||||
leafNodeNames: leafNodeNames,
|
||||
undo: {
|
||||
documentSizeThreshold: -1, // -1 means no threshold
|
||||
undoLimit: -1 // -1 means no limit
|
||||
},
|
||||
isInsertedHTMLSanitized: true,
|
||||
isSetHTMLSanitized: true,
|
||||
willCutCopy: null,
|
||||
addLinks: true // allow_smart_html_links
|
||||
*/
|
||||
sanitizeToDOMFragment: (html, isPaste/*, squire*/) => {
|
||||
|
|
@ -179,22 +161,22 @@ class SquireUI
|
|||
Georgia: "'URW Palladio L', Georgia, Times, serif"
|
||||
}
|
||||
},
|
||||
cmd: s => squire.setFontFace(s.value)
|
||||
cmd: s => squire.setStyle({ fontFamily: s.value })
|
||||
},
|
||||
fontSize: {
|
||||
select: ['11px','13px','16px','20px','24px','30px'],
|
||||
cmd: s => squire.setFontSize(s.value)
|
||||
cmd: s => squire.setStyle({ fontSize: s.value })
|
||||
}
|
||||
},
|
||||
colors: {
|
||||
textColor: {
|
||||
html: 'A<sub>▾</sub>',
|
||||
cmd: doClr('setTextColour'),
|
||||
cmd: doClr('setTextColor'),
|
||||
hint: 'Text color'
|
||||
},
|
||||
backgroundColor: {
|
||||
html: '🎨', /* ▧ */
|
||||
cmd: doClr('setHighlightColour'),
|
||||
cmd: doClr('setBackgroundColor'),
|
||||
hint: 'Background color'
|
||||
},
|
||||
},
|
||||
|
|
@ -215,37 +197,37 @@ class SquireUI
|
|||
inline: {
|
||||
bold: {
|
||||
html: 'B',
|
||||
cmd: () => this.doAction('bold','B'),
|
||||
cmd: () => this.doAction('bold'),
|
||||
key: 'B',
|
||||
hint: 'Bold'
|
||||
},
|
||||
italic: {
|
||||
html: 'I',
|
||||
cmd: () => this.doAction('italic','I'),
|
||||
cmd: () => this.doAction('italic'),
|
||||
key: 'I',
|
||||
hint: 'Italic'
|
||||
},
|
||||
underline: {
|
||||
html: '<u>U</u>',
|
||||
cmd: () => this.doAction('underline','U'),
|
||||
cmd: () => this.doAction('underline'),
|
||||
key: 'U',
|
||||
hint: 'Underline'
|
||||
},
|
||||
strike: {
|
||||
html: '<s>S</s>',
|
||||
cmd: () => this.doAction('strikethrough','S'),
|
||||
cmd: () => this.doAction('strikethrough'),
|
||||
key: 'Shift + 7',
|
||||
hint: 'Strikethrough'
|
||||
},
|
||||
sub: {
|
||||
html: 'Xₙ',
|
||||
cmd: () => this.doAction('subscript','SUB'),
|
||||
cmd: () => this.doAction('subscript'),
|
||||
key: 'Shift + 5',
|
||||
hint: 'Subscript'
|
||||
},
|
||||
sup: {
|
||||
html: 'Xⁿ',
|
||||
cmd: () => this.doAction('superscript','SUP'),
|
||||
cmd: () => this.doAction('superscript'),
|
||||
key: 'Shift + 6',
|
||||
hint: 'Superscript'
|
||||
}
|
||||
|
|
@ -470,11 +452,9 @@ class SquireUI
|
|||
};
|
||||
}
|
||||
|
||||
doAction(name, tag) {
|
||||
if (this.testPresenceinSelection(tag, new RegExp('>'+tag+'\\b'))) {
|
||||
name = 'remove' + (name.toUpperCase()[0]) + name.substr(1);
|
||||
}
|
||||
doAction(name) {
|
||||
this.squire[name]();
|
||||
this.squire.focus();
|
||||
}
|
||||
|
||||
getParentNodeName(selector) {
|
||||
|
|
|
|||
|
|
@ -72,22 +72,6 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
|
||||
this.viewProperties = ko.observableArray();
|
||||
|
||||
/*
|
||||
// Somehow this is broken now when calling addNewProperty
|
||||
const fFastClearEmptyListHelper = list => {
|
||||
if (list && list.length) {
|
||||
this.viewProperties.removeAll(list);
|
||||
delegateRunOnDestroy(list);
|
||||
}
|
||||
};
|
||||
this.addSubscribables({
|
||||
viewPropertiesEmailsEmptyAndOnFocused: fFastClearEmptyListHelper,
|
||||
viewPropertiesPhonesEmptyAndOnFocused: fFastClearEmptyListHelper,
|
||||
viewPropertiesWebEmptyAndOnFocused: fFastClearEmptyListHelper,
|
||||
viewPropertiesOtherEmptyAndOnFocused: fFastClearEmptyListHelper
|
||||
});
|
||||
*/
|
||||
|
||||
this.useCheckboxesInList = SettingsStore.useCheckboxesInList;
|
||||
|
||||
this.selector = new Selector(
|
||||
|
|
@ -135,12 +119,7 @@ class ContactsPopupView extends AbstractViewPopup {
|
|||
viewPropertiesPhones: () => this.viewProperties.filter(property => property.isType(ContactPropertyType.Phone)),
|
||||
|
||||
contactHasValidName: () => !!this.viewProperties.find(prop => propertyIsName(prop) && prop.isValid()),
|
||||
/*
|
||||
viewPropertiesEmailsEmptyAndOnFocused: () => this.viewPropertiesEmails().filter(propertyFocused),
|
||||
viewPropertiesPhonesEmptyAndOnFocused: () => this.viewPropertiesPhones().filter(propertyFocused),
|
||||
viewPropertiesWebEmptyAndOnFocused: () => this.viewPropertiesWeb().filter(propertyFocused),
|
||||
viewPropertiesOtherEmptyAndOnFocused: () => this.viewPropertiesOther().filter(propertyFocused),
|
||||
*/
|
||||
|
||||
contactsCheckedOrSelected: () => {
|
||||
const checked = this.contacts.filter(item => item.checked && item.checked()),
|
||||
selected = this.currentContact();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue