Compare commits
No commits in common. "847a3731f9ef26e09245af72dbceb726463c6c7e" and "c98a5c83191fff13fc981fa1a75d215e1b1b3887" have entirely different histories.
847a3731f9
...
c98a5c8319
2 changed files with 6 additions and 8 deletions
|
@ -1,4 +1,5 @@
|
||||||
<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";
|
||||||
|
@ -9,6 +10,7 @@
|
||||||
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,19 +307,15 @@ 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 (
|
if (href?.startsWith("/w/")) {
|
||||||
href &&
|
const matches = parse(routes.Page).pattern.exec(href);
|
||||||
/[useandom\-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict]{21}/.test(
|
if (!matches) return false;
|
||||||
href
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return {
|
return {
|
||||||
id: href,
|
id: matches[1],
|
||||||
};
|
};
|
||||||
} else return false;
|
} else return false;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue