Change anchor reference syntax
This commit is contained in:
+1
-1
@@ -280,7 +280,7 @@ export class Client {
|
||||
const matchingAnchor = await this.system.system.localSyscall(
|
||||
"index",
|
||||
"system.invokeFunction",
|
||||
["getObjectByRef", pageName, "anchor", `${pageName}@${pos}`],
|
||||
["getObjectByRef", pageName, "anchor", `${pageName}$${pos}`],
|
||||
);
|
||||
|
||||
if (!matchingAnchor) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ export class PathPageNavigator {
|
||||
decodeURI(): [string, number | string] {
|
||||
const [page, pos] = decodeURI(
|
||||
location.pathname.substring(this.root.length + 1),
|
||||
).split("@");
|
||||
).split(/[@$]/);
|
||||
if (pos) {
|
||||
if (pos.match(/^\d+$/)) {
|
||||
return [page, +pos];
|
||||
|
||||
Reference in New Issue
Block a user