Compare commits

..

2 commits

Author SHA1 Message Date
847a3731f9 pegar links internos correctamente
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-04-20 09:08:11 -03:00
7c8d36e7c3 limpiar código 2023-04-18 19:30:49 -03:00
2 changed files with 8 additions and 6 deletions

View file

@ -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

View file

@ -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;
}, },