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

View file

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