@bhsd/codemirror-mediawiki 3.11.2 → 3.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/statusBar.js CHANGED
@@ -92,6 +92,13 @@ const updateMenu = (cm, allDiagnostics, main, classList, optionAll, menu, fixer)
92
92
  menu.replaceChildren(...actions, ...quickfix);
93
93
  }
94
94
  };
95
+ const updatePosition = (doc, { head, empty, from, to }, position) => {
96
+ const { number, from: f } = doc.lineAt(head);
97
+ position.textContent = `${number}:${head - f}`;
98
+ if (!empty) {
99
+ position.textContent += ` (${to - from})`;
100
+ }
101
+ };
95
102
  export default (cm, fixer) => [
96
103
  showPanel.of(view => {
97
104
  let diagnostics = [];
@@ -119,10 +126,11 @@ export default (cm, fixer) => [
119
126
  });
120
127
  view.dom.append(menu);
121
128
  }
122
- const error = getLintMarker(view, 'error'), warning = getLintMarker(view, 'warning'), fix = getLintMarker(view, 'fix', menu), { classList } = fix.firstChild, optionAll = elt('div', 'Fix all auto-fixable problems'), worker = elt('div', { class: workerSelector.slice(1) }, error, warning, fix), message = elt('div', { class: messageSelector.slice(1) }), position = elt('div', { class: lineCls }, '0:0'), dom = elt('div', { class: `${panelSelector.slice(1)} ${statusSelector.slice(1)}` }, worker, message, position);
129
+ const error = getLintMarker(view, 'error'), warning = getLintMarker(view, 'warning'), fix = getLintMarker(view, 'fix', menu), { classList } = fix.firstChild, optionAll = elt('div', 'Fix all auto-fixable problems'), worker = elt('div', { class: workerSelector.slice(1) }, error, warning, fix), message = elt('div', { class: messageSelector.slice(1) }), position = elt('div', { class: lineCls }), dom = elt('div', { class: `${panelSelector.slice(1)} ${statusSelector.slice(1)}` }, worker, message, position);
123
130
  position.addEventListener('click', () => {
124
131
  gotoLine(view);
125
132
  });
133
+ updatePosition(view.state.doc, view.state.selection.main, position);
126
134
  return {
127
135
  dom,
128
136
  update({ state: { selection: { main }, doc }, transactions, docChanged, selectionSet }) {
@@ -141,11 +149,7 @@ export default (cm, fixer) => [
141
149
  if (docChanged || selectionSet) {
142
150
  updateDiagnosticMessage(view, diagnostics, main, message);
143
151
  updateMenu(cm, diagnostics, main, classList, optionAll, menu, fixer);
144
- const { number, from } = doc.lineAt(main.head);
145
- position.textContent = `${number}:${main.head - from}`;
146
- if (!main.empty) {
147
- position.textContent += ` (${main.to - main.from})`;
148
- }
152
+ updatePosition(doc, main, position);
149
153
  }
150
154
  },
151
155
  };
package/dist/token.js CHANGED
@@ -996,8 +996,8 @@ let MediaWiki = (() => {
996
996
  eatDoubleUnderscore(style, ch, stream, state) {
997
997
  const { doubleUnderscore } = this.config, underscore = ch.repeat(2), name = stream.match(doubleUnderscoreRegex[ch]);
998
998
  if (name) {
999
- if (Object.prototype.hasOwnProperty.call(doubleUnderscore[0], underscore + name[0].toLowerCase())
1000
- || Object.prototype.hasOwnProperty.call(doubleUnderscore[1], underscore + name[0])) {
999
+ if (Object.hasOwn(doubleUnderscore[0], underscore + name[0].toLowerCase())
1000
+ || Object.hasOwn(doubleUnderscore[1], underscore + name[0])) {
1001
1001
  return tokens.doubleUnderscore;
1002
1002
  }
1003
1003
  else if (!stream.eol()) {
@@ -1421,10 +1421,8 @@ let MediaWiki = (() => {
1421
1421
  else if (delimiter !== ':') {
1422
1422
  ff = f.trim();
1423
1423
  }
1424
- const ffLower = ff.toLowerCase(), { functionSynonyms, variableIDs, functionHooks } = this.config, canonicalName = Object.prototype.hasOwnProperty.call(functionSynonyms[1], ff)
1425
- && functionSynonyms[1][ff]
1426
- || Object.prototype.hasOwnProperty.call(functionSynonyms[0], ffLower)
1427
- && functionSynonyms[0][ffLower];
1424
+ const ffLower = ff.toLowerCase(), { functionSynonyms, variableIDs, functionHooks } = this.config, canonicalName = Object.hasOwn(functionSynonyms[1], ff) && functionSynonyms[1][ff]
1425
+ || Object.hasOwn(functionSynonyms[0], ffLower) && functionSynonyms[0][ffLower];
1428
1426
  if ((!delimiter || fullWidth || delimiter === ':' || delimiter === '}')
1429
1427
  && canonicalName
1430
1428
  && !substs.has(canonicalName)