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">
|
||||
import type { NodeType } from "prosemirror-model";
|
||||
import type { EditorState } from "prosemirror-state";
|
||||
import type { EditorView } from "prosemirror-view";
|
||||
import { setBlockType } from "prosemirror-commands";
|
||||
|
@ -10,7 +9,6 @@
|
|||
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
|
||||
|
|
|
@ -307,15 +307,19 @@ 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?.startsWith("/w/")) {
|
||||
const matches = parse(routes.Page).pattern.exec(href);
|
||||
if (!matches) return false;
|
||||
if (
|
||||
href &&
|
||||
/[useandom\-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict]{21}/.test(
|
||||
href
|
||||
)
|
||||
) {
|
||||
return {
|
||||
id: matches[1],
|
||||
id: href,
|
||||
};
|
||||
} else return false;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue