@bhsd/codemirror-mediawiki 3.6.2 → 3.6.3
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/README.md +1 -0
- package/dist/fold.d.ts +1 -1
- package/dist/fold.js +15 -2
- package/dist/main.min.js +21 -21
- package/dist/mediawiki.d.ts +5 -0
- package/dist/mediawiki.js +23 -11
- package/dist/mw.min.js +28 -28
- package/dist/theme.js +2 -0
- package/dist/token.js +1 -2
- package/dist/wiki.min.js +28 -28
- package/i18n/en.json +1 -1
- package/i18n/zh-hans.json +1 -1
- package/i18n/zh-hant.json +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@bhsd/codemirror-mediawiki)
|
|
2
|
+
[](https://github.com/bhsd-harry/codemirror-mediawiki/actions/workflows/codeql.yml)
|
|
2
3
|
[](https://www.npmjs.com/package/@bhsd/codemirror-mediawiki)
|
|
3
4
|
[](https://app.codacy.com/gh/bhsd-harry/codemirror-mediawiki/dashboard)
|
|
4
5
|
|
package/dist/fold.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface DocRange {
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const foldable: (state: EditorState, posOrNode: number | SyntaxNode, tree?: Tree | null, refOnly?: boolean) => DocRange | false;
|
|
17
17
|
export declare const foldableLine: ({ state, viewport: { to: end }, viewportLineBlocks }: EditorView, { from: f, to: t }: DocRange) => DocRange | false;
|
|
18
|
-
export declare const foldRef: Command;
|
|
18
|
+
export declare const foldRef: Command, unfoldRef: Command;
|
|
19
19
|
declare const _default: (e?: Extension | undefined) => Extension;
|
|
20
20
|
export default _default;
|
|
21
21
|
export declare const mediaWikiFold: Extension;
|
package/dist/fold.js
CHANGED
|
@@ -321,10 +321,23 @@ const defaultFoldExtension = /* @__PURE__ */ (() => [foldGutter(), keymap.of(fol
|
|
|
321
321
|
* @param refOnly 是否仅检查`<ref>`标签
|
|
322
322
|
*/
|
|
323
323
|
const foldCommand = (refOnly) => view => {
|
|
324
|
-
const { state } = view, tree = syntaxTree(state), effects = [], anchor = traverse(state, tree, effects, tree.topNode.firstChild, Infinity, getAnchor(state), updateAll, refOnly);
|
|
324
|
+
const { state } = view, tree = ensureSyntaxTree(state, state.doc.length, 1e3) ?? syntaxTree(state), effects = [], anchor = traverse(state, tree, effects, tree.topNode.firstChild, Infinity, getAnchor(state), updateAll, refOnly);
|
|
325
325
|
return execute(view, effects, anchor);
|
|
326
326
|
};
|
|
327
|
-
export const foldRef = /* @__PURE__ */ foldCommand(true)
|
|
327
|
+
export const foldRef = /* @__PURE__ */ foldCommand(true), unfoldRef = (view) => {
|
|
328
|
+
const { state } = view, tree = syntaxTree(state), effects = [];
|
|
329
|
+
foldedRanges(state).between(0, state.doc.length, (i, j) => {
|
|
330
|
+
const node = tree.resolve(i, -1);
|
|
331
|
+
if (isExtBracket(node) && isExt(node.nextSibling, true)) {
|
|
332
|
+
effects.push(unfoldEffect.of({ from: i, to: j }));
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
if (effects.length > 0) {
|
|
336
|
+
view.dispatch({ effects });
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
return false;
|
|
340
|
+
};
|
|
328
341
|
export default ((e = defaultFoldExtension) => e);
|
|
329
342
|
export const mediaWikiFold = /* @__PURE__ */ (() => [
|
|
330
343
|
codeFolding({
|