Change anchor reference syntax

This commit is contained in:
Zef Hemel
2023-11-03 12:01:33 +01:00
parent 28b0e9f9e9
commit e0b6fbed3e
20 changed files with 47 additions and 31 deletions
+7 -7
View File
@@ -15,7 +15,7 @@ class IFrameWidget extends WidgetType {
constructor(
readonly from: number,
readonly to: number,
readonly editor: Client,
readonly client: Client,
readonly bodyText: string,
readonly codeWidgetCallback: CodeWidgetCallback,
) {
@@ -25,20 +25,20 @@ class IFrameWidget extends WidgetType {
toDOM(): HTMLElement {
const from = this.from;
const iframe = createWidgetSandboxIFrame(
this.editor,
this.client,
this.bodyText,
this.codeWidgetCallback(this.bodyText, this.editor.currentPage!),
this.codeWidgetCallback(this.bodyText, this.client.currentPage!),
(message) => {
switch (message.type) {
case "blur":
this.editor.editorView.dispatch({
this.client.editorView.dispatch({
selection: { anchor: from },
});
this.editor.focus();
this.client.focus();
break;
case "reload":
this.codeWidgetCallback(this.bodyText, this.editor.currentPage!)
this.codeWidgetCallback(this.bodyText, this.client.currentPage!)
.then(
(widgetContent: WidgetContent) => {
iframe.contentWindow!.postMessage({
@@ -61,7 +61,7 @@ class IFrameWidget extends WidgetType {
}
get estimatedHeight(): number {
const cachedHeight = this.editor.space.getCachedWidgetHeight(this.bodyText);
const cachedHeight = this.client.space.getCachedWidgetHeight(this.bodyText);
// console.log("Calling estimated height", cachedHeight);
return cachedHeight > 0 ? cachedHeight : 150;
}
+1 -3
View File
@@ -31,9 +31,7 @@ export function cleanWikiLinkPlugin(editor: Client) {
const allPages = editor.space.listPages();
let pageExists = !editor.fullSyncCompleted;
let cleanPage = page;
if (page.includes("@")) {
cleanPage = page.split("@")[0];
}
cleanPage = page.split(/[@$]/)[0];
cleanPage = resolvePath(editor.currentPage!, cleanPage);
const lowerCasePageName = cleanPage.toLowerCase();
for (const pageMeta of allPages) {