Compare commits
2 commits
c98a5c8319
...
847a3731f9
Author | SHA1 | Date | |
---|---|---|---|
847a3731f9 | |||
7c8d36e7c3 |
2 changed files with 8 additions and 6 deletions
|
@ -1,5 +1,4 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { NodeType } from "prosemirror-model";
|
|
||||||
import type { EditorState } from "prosemirror-state";
|
import type { EditorState } from "prosemirror-state";
|
||||||
import type { EditorView } from "prosemirror-view";
|
import type { EditorView } from "prosemirror-view";
|
||||||
import { setBlockType } from "prosemirror-commands";
|
import { setBlockType } from "prosemirror-commands";
|
||||||
|
@ -10,7 +9,6 @@
|
||||||
const paragraphType = state.schema.nodes.paragraph;
|
const paragraphType = state.schema.nodes.paragraph;
|
||||||
const headingType = state.schema.nodes.heading;
|
const headingType = state.schema.nodes.heading;
|
||||||
|
|
||||||
$: isPossible = setBlockType(headingType, { level: 1 })(state);
|
|
||||||
$: currentValue =
|
$: currentValue =
|
||||||
state.selection.to <= state.selection.$from.end() &&
|
state.selection.to <= state.selection.$from.end() &&
|
||||||
(state.selection.$from.parent.type == headingType
|
(state.selection.$from.parent.type == headingType
|
||||||
|
|
|
@ -307,15 +307,19 @@ export const schema = new Schema({
|
||||||
parseDOM: [
|
parseDOM: [
|
||||||
{
|
{
|
||||||
tag: "a[href]",
|
tag: "a[href]",
|
||||||
|
priority: 100,
|
||||||
// TODO: untested
|
// TODO: untested
|
||||||
getAttrs(dom) {
|
getAttrs(dom) {
|
||||||
dom = dom as HTMLElement;
|
dom = dom as HTMLElement;
|
||||||
const href = dom.getAttribute("href");
|
const href = dom.getAttribute("href");
|
||||||
if (href?.startsWith("/w/")) {
|
if (
|
||||||
const matches = parse(routes.Page).pattern.exec(href);
|
href &&
|
||||||
if (!matches) return false;
|
/[useandom\-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict]{21}/.test(
|
||||||
|
href
|
||||||
|
)
|
||||||
|
) {
|
||||||
return {
|
return {
|
||||||
id: matches[1],
|
id: href,
|
||||||
};
|
};
|
||||||
} else return false;
|
} else return false;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue