Merge branch 'master' into order

This commit is contained in:
tophf 2022-01-28 15:54:59 +03:00
commit 4cc367587d
10 changed files with 60 additions and 61 deletions

View File

@ -32,7 +32,7 @@
title: 'editDeleteText', title: 'editDeleteText',
type: 'normal', type: 'normal',
contexts: ['editable'], contexts: ['editable'],
documentUrlPatterns: [URLS.ownOrigin + 'edit*'], documentUrlPatterns: [URLS.ownOrigin + '*'],
click: (info, tab) => { click: (info, tab) => {
msg.sendTab(tab.id, {method: 'editDeleteText'}, undefined, 'extension') msg.sendTab(tab.id, {method: 'editDeleteText'}, undefined, 'extension')
.catch(msg.ignoreError); .catch(msg.ignoreError);

View File

@ -102,7 +102,7 @@
</p> </p>
<label i18n-text="sectionCode" class="code-label"></label> <label i18n-text="sectionCode" class="code-label"></label>
<div class="applies-to"> <div class="applies-to">
<label i18n-text="appliesLabel"> <label i18n-text="appliesLabel" data-cmd="note" i18n-title="appliesHelp">
<a class="svg-inline-wrapper applies-to-help" tabindex="0"> <a class="svg-inline-wrapper applies-to-help" tabindex="0">
<svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg> <svg class="svg-icon info"><use xlink:href="#svg-icon-help"/></svg>
</a> </a>

View File

@ -191,9 +191,6 @@ label {
#colorpicker-settings.svg-inline-wrapper { #colorpicker-settings.svg-inline-wrapper {
margin: -2px 0 0 .1rem; margin: -2px 0 0 .1rem;
} }
.svg-inline-wrapper.applies-to-help {
margin: 0 0 0 .25rem;
}
.aligned .svg-inline-wrapper { .aligned .svg-inline-wrapper {
margin: -2px 0 0 .3rem; margin: -2px 0 0 .3rem;
} }
@ -456,7 +453,7 @@ input:invalid {
display: none; display: none;
} }
.section .CodeMirror { .section .CodeMirror {
margin-bottom: .875rem; margin-bottom: .5em;
box-sizing: border-box; box-sizing: border-box;
} }
/* deleted section */ /* deleted section */
@ -475,19 +472,20 @@ input:invalid {
.section.removed .CodeMirror { .section.removed .CodeMirror {
display: none; display: none;
} }
.move-section-down:after,
.move-section-up:after { .move-section-up:after {
content: ""; content: "";
display: block; display: block;
border-style: solid; border: var(--side) solid transparent;
border-width: 0 .3em .5em .3em; --side: .4em;
border-color: transparent transparent currentColor transparent; }
.move-section-up:after {
border-bottom: calc(var(--side) * 1.3) solid currentColor;
margin: -50% 0 0 0;
} }
.move-section-down:after { .move-section-down:after {
content: ""; border-top: calc(var(--side) * 1.3) solid currentColor;
display: block; margin: 0 0 -60% 0;
border-style: solid;
border-width: .5em .3em 0 .3em;
border-color: currentColor transparent transparent transparent;
} }
/* code */ /* code */
.code { .code {
@ -579,12 +577,19 @@ body:not(.find-open) [data-match-highlight-count="1"] .CodeMirror-selection-high
border-color: #f008; border-color: #f008;
} }
.applies-to label { .applies-to label {
display: flex; font-size: 0;
padding: 0; padding: 0;
height: 22px; margin-left: -24px;
align-items: center; position: absolute;
margin: 0 .2em 0 0; line-height: var(--input-height);
white-space: nowrap; }
.compact-layout .applies-to label {
display: none;
}
.compact-layout .applies-to[data-all] label {
position: static;
display: inline;
margin: 0 6px 0 -4px;
} }
.applies-to ul { .applies-to ul {
flex: auto; flex: auto;
@ -597,16 +602,17 @@ body:not(.find-open) [data-match-highlight-count="1"] .CodeMirror-selection-high
flex-wrap: wrap; flex-wrap: wrap;
list-style-type: none; list-style-type: none;
align-items: center; align-items: center;
margin-bottom: .5em;
} }
.applies-to li.applies-to-everything { .applies-to li.applies-to-everything {
align-items: unset; align-items: unset;
line-height: 22px; line-height: var(--input-height);
} }
.applies-to li > input { .applies-to li > input {
min-height: 1.4rem; min-height: 1.4rem;
} }
.applies-to li:not(.applies-to-everything) > * { .applies-to .select-resizer {
margin: 0 .2rem .5rem 0; margin-right: .5em;
} }
.applies-to li .add-applies-to:first-child { .applies-to li .add-applies-to:first-child {
margin-left: 1rem; margin-left: 1rem;
@ -625,8 +631,8 @@ body:not(.find-open) [data-match-highlight-count="1"] .CodeMirror-selection-high
.add-applies-to, .add-applies-to,
.remove-applies-to { .remove-applies-to {
font-size: 0; font-size: 0;
height: 22px; height: var(--input-height);
width: 22px; width: var(--input-height);
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -812,7 +818,10 @@ body:not(.find-open) [data-match-highlight-count="1"] .CodeMirror-selection-high
margin: .25em 0; margin: .25em 0;
} }
#help-popup .buttons > :nth-child(n + 2) { #help-popup .buttons > :nth-child(n + 2) {
margin-inline: .5em 0; margin: 0 0 0 .5em;
}
.non-windows #help-popup .buttons > :nth-child(n + 2) {
margin: 0 .5em 0 0;
} }
/************ lint ************/ /************ lint ************/

View File

@ -79,9 +79,6 @@ msg.onExtension(request => {
closeCurrentTab(); closeCurrentTab();
} }
break; break;
case 'editDeleteText':
document.execCommand('delete');
break;
} }
}); });

View File

@ -1,4 +1,4 @@
/* global $ */// dom.js /* global $ toggleDataset */// dom.js
/* global MozDocMapper trimCommentLabel */// util.js /* global MozDocMapper trimCommentLabel */// util.js
/* global cmFactory */ /* global cmFactory */
/* global debounce tryRegExp */// toolbox.js /* global debounce tryRegExp */// toolbox.js
@ -35,7 +35,8 @@ function createSection(originalSection, genId, si) {
const changeListeners = new Set(); const changeListeners = new Set();
const appliesToContainer = $('.applies-to-list', el); const appliesToContainer = $('.applies-to', el);
const appliesToList = $('.applies-to-list', el);
const appliesTo = []; const appliesTo = [];
MozDocMapper.forEachProp(originalSection, (type, value) => MozDocMapper.forEachProp(originalSection, (type, value) =>
insertApplyAfter({type, value})); insertApplyAfter({type, value}));
@ -234,7 +235,8 @@ function createSection(originalSection, genId, si) {
function insertApplyAfter(init, base) { function insertApplyAfter(init, base) {
const apply = createApply(init); const apply = createApply(init);
appliesTo.splice(base ? appliesTo.indexOf(base) + 1 : appliesTo.length, 0, apply); appliesTo.splice(base ? appliesTo.indexOf(base) + 1 : appliesTo.length, 0, apply);
appliesToContainer.insertBefore(apply.el, base ? base.el.nextSibling : null); appliesToList.insertBefore(apply.el, base ? base.el.nextSibling : null);
toggleDataset(appliesToContainer, 'all', init.all);
dirty.add(apply, apply); dirty.add(apply, apply);
if (appliesTo.length > 1 && appliesTo[0].all) { if (appliesTo.length > 1 && appliesTo[0].all) {
removeApply(appliesTo[0]); removeApply(appliesTo[0]);
@ -251,6 +253,7 @@ function createSection(originalSection, genId, si) {
dirty.remove(apply, apply); dirty.remove(apply, apply);
if (!appliesTo.length) { if (!appliesTo.length) {
insertApplyAfter({all: true}); insertApplyAfter({all: true});
toggleDataset(appliesToContainer, 'all', true);
} }
emitSectionChange('apply'); emitSectionChange('apply');
} }

View File

@ -1,12 +1,11 @@
/* global $ $$ $create $remove messageBoxProxy */// dom.js /* global $ $create $remove messageBoxProxy */// dom.js
/* global API */// msg.js /* global API */// msg.js
/* global CodeMirror */ /* global CodeMirror */
/* global FIREFOX RX_META debounce ignoreChromeError */// toolbox.js /* global RX_META debounce */// toolbox.js
/* global MozDocMapper clipString helpPopup rerouteHotkeys showCodeMirrorPopup */// util.js /* global MozDocMapper clipString helpPopup rerouteHotkeys showCodeMirrorPopup */// util.js
/* global createSection */// sections-editor-section.js /* global createSection */// sections-editor-section.js
/* global editor */ /* global editor */
/* global linterMan */ /* global linterMan */
/* global prefs */
/* global styleSectionsEqual */ // sections-util.js /* global styleSectionsEqual */ // sections-util.js
/* global t */// localization.js /* global t */// localization.js
'use strict'; 'use strict';
@ -33,10 +32,6 @@ function SectionsEditor() {
$('#from-mozilla').on('click', () => showMozillaFormatImport()); $('#from-mozilla').on('click', () => showMozillaFormatImport());
document.on('wheel', scrollEntirePageOnCtrlShift, {passive: false}); document.on('wheel', scrollEntirePageOnCtrlShift, {passive: false});
CodeMirror.defaults.extraKeys['Shift-Ctrl-Wheel'] = 'scrollWindow'; CodeMirror.defaults.extraKeys['Shift-Ctrl-Wheel'] = 'scrollWindow';
if (!FIREFOX) {
$$('input:not([type]), input[type=text], input[type=search], input[type=number]')
.forEach(e => e.on('mousedown', toggleContextMenuDelete));
}
/** @namespace Editor */ /** @namespace Editor */
Object.assign(editor, { Object.assign(editor, {
@ -613,7 +608,6 @@ function SectionsEditor() {
/** @param {EditorSection} section */ /** @param {EditorSection} section */
function registerEvents(section) { function registerEvents(section) {
const {el, cm} = section; const {el, cm} = section;
$('.applies-to-help', el).onclick = () => helpPopup.show(t('appliesLabel'), t('appliesHelp'));
$('.remove-section', el).onclick = () => removeSection(section); $('.remove-section', el).onclick = () => removeSection(section);
$('.add-section', el).onclick = () => insertSectionAfter(undefined, section); $('.add-section', el).onclick = () => insertSectionAfter(undefined, section);
$('.clone-section', el).onclick = () => insertSectionAfter(section.getModel(), section); $('.clone-section', el).onclick = () => insertSectionAfter(section.getModel(), section);
@ -621,9 +615,6 @@ function SectionsEditor() {
$('.move-section-down', el).onclick = () => moveSectionDown(section); $('.move-section-down', el).onclick = () => moveSectionDown(section);
$('.restore-section', el).onclick = () => restoreSection(section); $('.restore-section', el).onclick = () => restoreSection(section);
cm.on('paste', maybeImportOnPaste); cm.on('paste', maybeImportOnPaste);
if (!FIREFOX) {
cm.on('mousedown', (cm, event) => toggleContextMenuDelete.call(cm, event));
}
} }
function maybeImportOnPaste(cm, event) { function maybeImportOnPaste(cm, event) {
@ -668,15 +659,4 @@ function SectionsEditor() {
linterMan.enableForEditor(cm); linterMan.enableForEditor(cm);
cm.refresh(); cm.refresh();
} }
function toggleContextMenuDelete(event) {
if (chrome.contextMenus && event.button === 2 && prefs.get('editor.contextDelete')) {
chrome.contextMenus.update('editor.contextDelete', {
enabled: Boolean(
this.selectionStart !== this.selectionEnd ||
this.somethingSelected && this.somethingSelected()
),
}, ignoreChromeError);
}
}
} }

View File

@ -5,7 +5,7 @@
width: 90%; width: 90%;
} }
.style-settings { .style-settings {
padding: 0; padding: 0 1px; /* for focus outline */
border: 0; border: 0;
margin: 0; margin: 0;
} }

View File

@ -6,6 +6,7 @@ html#stylus #header *:not(#\1transition-suppressor) {
} }
:root { :root {
--family: Arial, "Helvetica Neue", Helvetica, system-ui, sans-serif; --family: Arial, "Helvetica Neue", Helvetica, system-ui, sans-serif;
--input-height: 22px;
} }
body { body {
font: normal 12px var(--family); font: normal 12px var(--family);
@ -68,12 +69,14 @@ input {
} }
input:not([type]), input:not([type]),
input[type=text],
input[type=search] { input[type=search] {
background: #fff; background: #fff;
color: #000; color: #000;
height: 22px; height: var(--input-height);
min-height: 22px!important; min-height: var(--input-height)!important;
line-height: 22px; line-height: var(--input-height);
box-sizing: border-box;
padding: 0 3px; padding: 0 3px;
border: 1px solid hsl(0, 0%, 66%); border: 1px solid hsl(0, 0%, 66%);
} }
@ -164,7 +167,7 @@ label {
select { select {
-moz-appearance: none; -moz-appearance: none;
-webkit-appearance: none; -webkit-appearance: none;
height: 22px; height: var(--input-height);
font: inherit; font: inherit;
color: #000; color: #000;
background-color: transparent; background-color: transparent;
@ -253,6 +256,7 @@ summary {
textarea[data-focused-via-click]:focus, textarea[data-focused-via-click]:focus,
input:not([type])[data-focused-via-click]:focus, /* same as "text" */ input:not([type])[data-focused-via-click]:focus, /* same as "text" */
input[type="text"][data-focused-via-click]:focus, input[type="text"][data-focused-via-click]:focus,
input[type="url"][data-focused-via-click]:focus,
input[type="search"][data-focused-via-click]:focus, input[type="search"][data-focused-via-click]:focus,
input[type="number"][data-focused-via-click]:focus { input[type="number"][data-focused-via-click]:focus {
/* Using box-shadow instead of the ugly outline in new Chrome */ /* Using box-shadow instead of the ugly outline in new Chrome */
@ -371,7 +375,7 @@ body.resizing-v > * {
.firefox select { .firefox select {
padding: 0 20px 0 2px; padding: 0 20px 0 2px;
line-height: 22px!important; line-height: var(--input-height)!important;
} }
svg { svg {

View File

@ -67,7 +67,7 @@
.config-body .onoffswitch { .config-body .onoffswitch {
width: var(--onoffswitch-width); width: var(--onoffswitch-width);
margin: 0; margin: 0;
height: 22px; height: var(--input-height);
box-sizing: border-box; box-sizing: border-box;
vertical-align: middle; vertical-align: middle;
} }
@ -112,7 +112,7 @@
} }
.config-number span, .config-range span { .config-number span, .config-range span {
line-height: 22px; line-height: var(--input-height);
} }
.config-body label:not(.nondefault) .config-reset-icon { .config-body label:not(.nondefault) .config-reset-icon {

View File

@ -1,5 +1,6 @@
/* global $$ $ $create focusAccessibility getEventKeyName moveFocus */// dom.js /* global $$ $ $create focusAccessibility getEventKeyName moveFocus */// dom.js
/* global clamp debounce */// toolbox.js /* global clamp debounce */// toolbox.js
/* global msg */
/* global t */// localization.js /* global t */// localization.js
'use strict'; 'use strict';
@ -15,6 +16,11 @@
window.on('wheel', changeFocusedInputOnWheel, {capture: true, passive: false}); window.on('wheel', changeFocusedInputOnWheel, {capture: true, passive: false});
window.on('click', e => splitMenu(e) || showTooltipNote(e)); window.on('click', e => splitMenu(e) || showTooltipNote(e));
window.on('resize', () => debounce(addTooltipsToEllipsized, 100)); window.on('resize', () => debounce(addTooltipsToEllipsized, 100));
msg.onExtension(request => {
if (request.method === 'editDeleteText') {
document.execCommand('delete');
}
});
// Removing transition-suppressor rule // Removing transition-suppressor rule
const {sheet} = $('link[href$="global.css"]'); const {sheet} = $('link[href$="global.css"]');
for (let i = 0, rule; (rule = sheet.cssRules[i]); i++) { for (let i = 0, rule; (rule = sheet.cssRules[i]); i++) {