Compare commits

..

No commits in common. "847a3731f9ef26e09245af72dbceb726463c6c7e" and "c98a5c83191fff13fc981fa1a75d215e1b1b3887" have entirely different histories.

2 changed files with 6 additions and 8 deletions

View file

@ -1,4 +1,5 @@
<script lang="ts">
import type { NodeType } from "prosemirror-model";
import type { EditorState } from "prosemirror-state";
import type { EditorView } from "prosemirror-view";
import { setBlockType } from "prosemirror-commands";
@ -9,6 +10,7 @@
const paragraphType = state.schema.nodes.paragraph;
const headingType = state.schema.nodes.heading;
$: isPossible = setBlockType(headingType, { level: 1 })(state);
$: currentValue =
state.selection.to <= state.selection.$from.end() &&
(state.selection.$from.parent.type == headingType

View file

@ -307,19 +307,15 @@ export const schema = new Schema({
parseDOM: [
{
tag: "a[href]",
priority: 100,
// TODO: untested
getAttrs(dom) {
dom = dom as HTMLElement;
const href = dom.getAttribute("href");
if (
href &&
/[useandom\-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict]{21}/.test(
href
)
) {
if (href?.startsWith("/w/")) {
const matches = parse(routes.Page).pattern.exec(href);
if (!matches) return false;
return {
id: href,
id: matches[1],
};
} else return false;
},