mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Replace Element.fromHTML() with createElement()
This commit is contained in:
parent
820b26a315
commit
415102aa37
3 changed files with 15 additions and 12 deletions
|
|
@ -18,7 +18,8 @@ const
|
||||||
SettingsUserStore.collapseBlockquotes() &&
|
SettingsUserStore.collapseBlockquotes() &&
|
||||||
// tpl.content.querySelectorAll('blockquote').forEach(node => {
|
// tpl.content.querySelectorAll('blockquote').forEach(node => {
|
||||||
[...tpl.content.querySelectorAll('blockquote')].reverse().forEach(node => {
|
[...tpl.content.querySelectorAll('blockquote')].reverse().forEach(node => {
|
||||||
const el = Element.fromHTML('<details class="sm-bq-switcher"><summary>•••</summary></details>');
|
const el = createElement('details', {class:'sm-bq-switcher'});
|
||||||
|
el.innerHTML = '<summary>•••</summary>';
|
||||||
node.replaceWith(el);
|
node.replaceWith(el);
|
||||||
el.append(node);
|
el.append(node);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -310,11 +310,13 @@ populateMessageBody = (oMessage, popup) => {
|
||||||
oMessage.isHtml(body.classList.contains('html'));
|
oMessage.isHtml(body.classList.contains('html'));
|
||||||
oMessage.hasImages(body.rlHasImages);
|
oMessage.hasImages(body.rlHasImages);
|
||||||
} else {
|
} else {
|
||||||
body = Element.fromHTML('<div id="' + id + '" hidden="" class="b-text-part '
|
body = createElement('div',{
|
||||||
+ (oMessage.pgpSigned() ? ' openpgp-signed' : '')
|
id:id,
|
||||||
+ (oMessage.pgpEncrypted() ? ' openpgp-encrypted' : '')
|
hidden:'',
|
||||||
+ '">'
|
class:'b-text-part'
|
||||||
+ '</div>');
|
+ (oMessage.pgpSigned() ? ' openpgp-signed' : '')
|
||||||
|
+ (oMessage.pgpEncrypted() ? ' openpgp-encrypted' : '')
|
||||||
|
});
|
||||||
oMessage.body = body;
|
oMessage.body = body;
|
||||||
if (!SettingsUserStore.viewHTML() || !oMessage.viewHtml()) {
|
if (!SettingsUserStore.viewHTML() || !oMessage.viewHtml()) {
|
||||||
oMessage.viewPlain();
|
oMessage.viewPlain();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import { koComputable } from 'External/ko';
|
import { koComputable } from 'External/ko';
|
||||||
import { doc, $htmlCL, elementById, fireEvent } from 'Common/Globals';
|
import { doc, $htmlCL, elementById, createElement, fireEvent } from 'Common/Globals';
|
||||||
import { forEachObjectEntry } from 'Common/Utils';
|
import { forEachObjectEntry } from 'Common/Utils';
|
||||||
import { i18nToNodes } from 'Common/Translator';
|
import { i18nToNodes } from 'Common/Translator';
|
||||||
|
|
||||||
|
|
@ -40,9 +40,9 @@ const
|
||||||
ViewModelClass.__vm = vm;
|
ViewModelClass.__vm = vm;
|
||||||
|
|
||||||
if (vmPlace) {
|
if (vmPlace) {
|
||||||
vmDom = Element.fromHTML(dialog
|
vmDom = dialog
|
||||||
? '<dialog id="V-'+ id + '"></dialog>'
|
? createElement('dialog',{id:'V-'+id})
|
||||||
: '<div id="V-'+ id + '" hidden=""></div>');
|
: createElement('div',{id:'V-'+id,hidden:''})
|
||||||
vmPlace.append(vmDom);
|
vmPlace.append(vmDom);
|
||||||
|
|
||||||
vm.viewModelDom = ViewModelClass.__dom = vmDom;
|
vm.viewModelDom = ViewModelClass.__dom = vmDom;
|
||||||
|
|
@ -55,7 +55,7 @@ const
|
||||||
vmDom.className = 'polyfill';
|
vmDom.className = 'polyfill';
|
||||||
vmDom.showModal = () => {
|
vmDom.showModal = () => {
|
||||||
vmDom.backdrop ||
|
vmDom.backdrop ||
|
||||||
vmDom.before(vmDom.backdrop = Element.fromHTML('<div class="dialog-backdrop"></div>'));
|
vmDom.before(vmDom.backdrop = createElement('div',{class:'dialog-backdrop'}));
|
||||||
vmDom.setAttribute('open','');
|
vmDom.setAttribute('open','');
|
||||||
vmDom.open = true;
|
vmDom.open = true;
|
||||||
vmDom.returnValue = null;
|
vmDom.returnValue = null;
|
||||||
|
|
@ -285,7 +285,7 @@ export const
|
||||||
});
|
});
|
||||||
|
|
||||||
const cross = new Crossroads();
|
const cross = new Crossroads();
|
||||||
cross.addRoute(/^([a-zA-Z0-9-]*)\/?(.*)$/, screenOnRoute);
|
cross.addRoute(/^([^/]+)\/?(.*)$/, screenOnRoute);
|
||||||
|
|
||||||
hasher.add(cross.parse.bind(cross));
|
hasher.add(cross.parse.bind(cross));
|
||||||
hasher.init();
|
hasher.init();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue