convert another tHTML in edit.js to $element

This commit is contained in:
tophf 2017-11-14 09:36:43 +03:00
parent 417d6855ff
commit 95be66cb61

View File

@ -1643,19 +1643,27 @@ function toMozillaFormat() {
} }
function fromMozillaFormat() { function fromMozillaFormat() {
const popup = showCodeMirrorPopup(t('styleFromMozillaFormatPrompt'), tHTML(`<div> const popup = showCodeMirrorPopup(t('styleFromMozillaFormatPrompt'),
<button name="import-append" i18n-text="importAppendLabel" i18n-title="importAppendTooltip"></button> $element({appendChild: [
<button name="import-replace" i18n-text="importReplaceLabel" i18n-title="importReplaceTooltip"></button> $element({
</div>` tag: 'button',
)); name: 'import-append',
textContent: t('importAppendLabel'),
title: t('importAppendTooltip'),
onclick: doImport,
}),
$element({
tag: 'button',
name: 'import-replace',
textContent: t('importReplaceLabel'),
title: t('importReplaceTooltip'),
onclick: doImport,
}),
]}));
const contents = $('.contents', popup); const contents = $('.contents', popup);
contents.insertBefore(popup.codebox.display.wrapper, contents.firstElementChild); contents.insertBefore(popup.codebox.display.wrapper, contents.firstElementChild);
popup.codebox.focus(); popup.codebox.focus();
$('[name="import-append"]', popup).addEventListener('click', doImport);
$('[name="import-replace"]', popup).addEventListener('click', doImport);
popup.codebox.on('change', () => { popup.codebox.on('change', () => {
clearTimeout(popup.mozillaTimeout); clearTimeout(popup.mozillaTimeout);
popup.mozillaTimeout = setTimeout(() => { popup.mozillaTimeout = setTimeout(() => {