feat: integrate pi rust lab runtime
This commit is contained in:
+19
-21
@@ -48,33 +48,31 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
||||
|
||||
export interface InitOutput {
|
||||
readonly memory: WebAssembly.Memory;
|
||||
readonly mount: (a: any, b: any) => [number, number, number];
|
||||
readonly mount_mindmap_shell: (a: any, b: any) => [number, number, number];
|
||||
readonly unmount: (a: number) => [number, number];
|
||||
readonly unmount_mindmap_shell: (a: number) => [number, number];
|
||||
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
||||
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
||||
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
||||
readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
|
||||
readonly intounderlyingbytesource_start: (a: number, b: any) => void;
|
||||
readonly intounderlyingbytesource_type: (a: number) => number;
|
||||
readonly mount: (a: any, b: any) => [number, number, number];
|
||||
readonly unmount: (a: number) => [number, number];
|
||||
readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
||||
readonly intounderlyingsink_abort: (a: number, b: any) => any;
|
||||
readonly intounderlyingsink_close: (a: number) => any;
|
||||
readonly intounderlyingsink_write: (a: number, b: any) => any;
|
||||
readonly intounderlyingsink_close: (a: number) => any;
|
||||
readonly intounderlyingsink_abort: (a: number, b: any) => any;
|
||||
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
||||
readonly intounderlyingbytesource_type: (a: number) => number;
|
||||
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
||||
readonly intounderlyingbytesource_start: (a: number, b: any) => void;
|
||||
readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
|
||||
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
||||
readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
||||
readonly intounderlyingsource_cancel: (a: number) => void;
|
||||
readonly intounderlyingsource_pull: (a: number, b: any) => any;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h854f4676fa692669: (a: number, b: number, c: any) => [number, number];
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h1a94ffe1b1ed8350: (a: number, b: number, c: any, d: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h8eb6fe4c74941e76: (a: number, b: number, c: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h62d2a368ae4b53af: (a: number, b: number, c: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h11eca4a91ce748ff: (a: number, b: number, c: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h62d2a368ae4b53af_4: (a: number, b: number, c: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__hc1d64d6259b30403: (a: number, b: number, c: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__hdc3cd9a3517d1395: (a: number, b: number) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h4fb07e4e902e51ce: (a: number, b: number) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__hec6d5749a9244252: (a: number, b: number) => void;
|
||||
readonly intounderlyingsource_cancel: (a: number) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h3a3182d847094e12: (a: number, b: number, c: any) => [number, number];
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h0accad0f5d87788a: (a: number, b: number, c: any, d: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h43695889c03f47e9: (a: number, b: number, c: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h87a7c2758b5f97bf: (a: number, b: number, c: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h43695889c03f47e9_3: (a: number, b: number, c: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h79038d3430a7951a: (a: number, b: number, c: any) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h67ea3224860feb45: (a: number, b: number) => void;
|
||||
readonly wasm_bindgen__convert__closures_____invoke__h29a925adc01712a5: (a: number, b: number) => void;
|
||||
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
||||
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
||||
readonly __externref_table_alloc: () => number;
|
||||
|
||||
+35
-53
@@ -812,7 +812,7 @@ function __wbg_get_imports() {
|
||||
const a = state0.a;
|
||||
state0.a = 0;
|
||||
try {
|
||||
return wasm_bindgen__convert__closures_____invoke__h1a94ffe1b1ed8350(a, state0.b, arg0, arg1);
|
||||
return wasm_bindgen__convert__closures_____invoke__h0accad0f5d87788a(a, state0.b, arg0, arg1);
|
||||
} finally {
|
||||
state0.a = a;
|
||||
}
|
||||
@@ -1232,66 +1232,56 @@ function __wbg_get_imports() {
|
||||
}
|
||||
}, arguments); },
|
||||
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1011, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
||||
const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h8eb6fe4c74941e76);
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1139, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h43695889c03f47e9);
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1140, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62d2a368ae4b53af);
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1191, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3a3182d847094e12);
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1202, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h854f4676fa692669);
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 993, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
||||
const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h87a7c2758b5f97bf);
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1110, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h11eca4a91ce748ff);
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1139, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h43695889c03f47e9_3);
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1140, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h62d2a368ae4b53af_4);
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 701, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h79038d3430a7951a);
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 563, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hc1d64d6259b30403);
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1108, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
||||
const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h67ea3224860feb45);
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1108, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hdc3cd9a3517d1395);
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1142, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h29a925adc01712a5);
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_0000000000000008: function(arg0, arg1) {
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1125, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
||||
const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h4fb07e4e902e51ce);
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_0000000000000009: function(arg0, arg1) {
|
||||
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1143, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
||||
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hec6d5749a9244252);
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_000000000000000a: function(arg0) {
|
||||
__wbindgen_cast_0000000000000008: function(arg0) {
|
||||
// Cast intrinsic for `F64 -> Externref`.
|
||||
const ret = arg0;
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_000000000000000b: function(arg0) {
|
||||
__wbindgen_cast_0000000000000009: function(arg0) {
|
||||
// Cast intrinsic for `I64 -> Externref`.
|
||||
const ret = arg0;
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_000000000000000c: function(arg0, arg1) {
|
||||
__wbindgen_cast_000000000000000a: function(arg0, arg1) {
|
||||
// Cast intrinsic for `Ref(String) -> Externref`.
|
||||
const ret = getStringFromWasm0(arg0, arg1);
|
||||
return ret;
|
||||
},
|
||||
__wbindgen_cast_000000000000000d: function(arg0) {
|
||||
__wbindgen_cast_000000000000000b: function(arg0) {
|
||||
// Cast intrinsic for `U64 -> Externref`.
|
||||
const ret = BigInt.asUintN(64, arg0);
|
||||
return ret;
|
||||
@@ -1316,47 +1306,39 @@ function __wbg_get_imports() {
|
||||
};
|
||||
}
|
||||
|
||||
function wasm_bindgen__convert__closures_____invoke__hdc3cd9a3517d1395(arg0, arg1) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__hdc3cd9a3517d1395(arg0, arg1);
|
||||
function wasm_bindgen__convert__closures_____invoke__h67ea3224860feb45(arg0, arg1) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h67ea3224860feb45(arg0, arg1);
|
||||
}
|
||||
|
||||
function wasm_bindgen__convert__closures_____invoke__h4fb07e4e902e51ce(arg0, arg1) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h4fb07e4e902e51ce(arg0, arg1);
|
||||
function wasm_bindgen__convert__closures_____invoke__h29a925adc01712a5(arg0, arg1) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h29a925adc01712a5(arg0, arg1);
|
||||
}
|
||||
|
||||
function wasm_bindgen__convert__closures_____invoke__hec6d5749a9244252(arg0, arg1) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__hec6d5749a9244252(arg0, arg1);
|
||||
function wasm_bindgen__convert__closures_____invoke__h43695889c03f47e9(arg0, arg1, arg2) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h43695889c03f47e9(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
function wasm_bindgen__convert__closures_____invoke__h8eb6fe4c74941e76(arg0, arg1, arg2) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h8eb6fe4c74941e76(arg0, arg1, arg2);
|
||||
function wasm_bindgen__convert__closures_____invoke__h87a7c2758b5f97bf(arg0, arg1, arg2) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h87a7c2758b5f97bf(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
function wasm_bindgen__convert__closures_____invoke__h62d2a368ae4b53af(arg0, arg1, arg2) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h62d2a368ae4b53af(arg0, arg1, arg2);
|
||||
function wasm_bindgen__convert__closures_____invoke__h43695889c03f47e9_3(arg0, arg1, arg2) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h43695889c03f47e9_3(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
function wasm_bindgen__convert__closures_____invoke__h11eca4a91ce748ff(arg0, arg1, arg2) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h11eca4a91ce748ff(arg0, arg1, arg2);
|
||||
function wasm_bindgen__convert__closures_____invoke__h79038d3430a7951a(arg0, arg1, arg2) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h79038d3430a7951a(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
function wasm_bindgen__convert__closures_____invoke__h62d2a368ae4b53af_4(arg0, arg1, arg2) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h62d2a368ae4b53af_4(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
function wasm_bindgen__convert__closures_____invoke__hc1d64d6259b30403(arg0, arg1, arg2) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__hc1d64d6259b30403(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
function wasm_bindgen__convert__closures_____invoke__h854f4676fa692669(arg0, arg1, arg2) {
|
||||
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h854f4676fa692669(arg0, arg1, arg2);
|
||||
function wasm_bindgen__convert__closures_____invoke__h3a3182d847094e12(arg0, arg1, arg2) {
|
||||
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h3a3182d847094e12(arg0, arg1, arg2);
|
||||
if (ret[1]) {
|
||||
throw takeFromExternrefTable0(ret[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function wasm_bindgen__convert__closures_____invoke__h1a94ffe1b1ed8350(arg0, arg1, arg2, arg3) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h1a94ffe1b1ed8350(arg0, arg1, arg2, arg3);
|
||||
function wasm_bindgen__convert__closures_____invoke__h0accad0f5d87788a(arg0, arg1, arg2, arg3) {
|
||||
wasm.wasm_bindgen__convert__closures_____invoke__h0accad0f5d87788a(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BIN
Binary file not shown.
Vendored
+19
-21
@@ -1,33 +1,31 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export const memory: WebAssembly.Memory;
|
||||
export const mount: (a: any, b: any) => [number, number, number];
|
||||
export const mount_mindmap_shell: (a: any, b: any) => [number, number, number];
|
||||
export const unmount: (a: number) => [number, number];
|
||||
export const unmount_mindmap_shell: (a: number) => [number, number];
|
||||
export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
||||
export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
||||
export const intounderlyingbytesource_cancel: (a: number) => void;
|
||||
export const intounderlyingbytesource_pull: (a: number, b: any) => any;
|
||||
export const intounderlyingbytesource_start: (a: number, b: any) => void;
|
||||
export const intounderlyingbytesource_type: (a: number) => number;
|
||||
export const mount: (a: any, b: any) => [number, number, number];
|
||||
export const unmount: (a: number) => [number, number];
|
||||
export const __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
||||
export const intounderlyingsink_abort: (a: number, b: any) => any;
|
||||
export const intounderlyingsink_close: (a: number) => any;
|
||||
export const intounderlyingsink_write: (a: number, b: any) => any;
|
||||
export const intounderlyingsink_close: (a: number) => any;
|
||||
export const intounderlyingsink_abort: (a: number, b: any) => any;
|
||||
export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
||||
export const intounderlyingbytesource_type: (a: number) => number;
|
||||
export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
||||
export const intounderlyingbytesource_start: (a: number, b: any) => void;
|
||||
export const intounderlyingbytesource_pull: (a: number, b: any) => any;
|
||||
export const intounderlyingbytesource_cancel: (a: number) => void;
|
||||
export const __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
||||
export const intounderlyingsource_cancel: (a: number) => void;
|
||||
export const intounderlyingsource_pull: (a: number, b: any) => any;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h854f4676fa692669: (a: number, b: number, c: any) => [number, number];
|
||||
export const wasm_bindgen__convert__closures_____invoke__h1a94ffe1b1ed8350: (a: number, b: number, c: any, d: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h8eb6fe4c74941e76: (a: number, b: number, c: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h62d2a368ae4b53af: (a: number, b: number, c: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h11eca4a91ce748ff: (a: number, b: number, c: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h62d2a368ae4b53af_4: (a: number, b: number, c: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__hc1d64d6259b30403: (a: number, b: number, c: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__hdc3cd9a3517d1395: (a: number, b: number) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h4fb07e4e902e51ce: (a: number, b: number) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__hec6d5749a9244252: (a: number, b: number) => void;
|
||||
export const intounderlyingsource_cancel: (a: number) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h3a3182d847094e12: (a: number, b: number, c: any) => [number, number];
|
||||
export const wasm_bindgen__convert__closures_____invoke__h0accad0f5d87788a: (a: number, b: number, c: any, d: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h43695889c03f47e9: (a: number, b: number, c: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h87a7c2758b5f97bf: (a: number, b: number, c: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h43695889c03f47e9_3: (a: number, b: number, c: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h79038d3430a7951a: (a: number, b: number, c: any) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h67ea3224860feb45: (a: number, b: number) => void;
|
||||
export const wasm_bindgen__convert__closures_____invoke__h29a925adc01712a5: (a: number, b: number) => void;
|
||||
export const __wbindgen_malloc: (a: number, b: number) => number;
|
||||
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
||||
export const __externref_table_alloc: () => number;
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
use crate::{
|
||||
current_page_anchor_url, editor_block_by_id, request_ai_edit_bridge,
|
||||
write_mnote_text_to_clipboard,
|
||||
};
|
||||
use crate::editor_runtime::{
|
||||
block_hover_state::{BlockMenuLayout, HoveredBlockState},
|
||||
block_transform::{
|
||||
@@ -17,6 +13,10 @@ use crate::editor_runtime::{
|
||||
persistence::{persist_document_state, persisted_document_identity, PersistedDocumentIdentity},
|
||||
slash_actions::{SlashActionKind, SLASH_ACTIONS},
|
||||
};
|
||||
use crate::{
|
||||
current_page_anchor_url, editor_block_by_id, request_ai_edit_bridge,
|
||||
write_mnote_text_to_clipboard,
|
||||
};
|
||||
use leptos::prelude::*;
|
||||
use leptos_tiptap::{TiptapEditorHandle, TiptapSelectionState, TiptapTextAlign};
|
||||
use serde_json::Value;
|
||||
@@ -132,10 +132,9 @@ fn handle_turn_into_action_click(
|
||||
&snapshot,
|
||||
Some(html),
|
||||
) {
|
||||
Ok(()) => signals.set_command_feedback.set(format!(
|
||||
"{}:块 -> {},并已写入本地草稿",
|
||||
message, label,
|
||||
)),
|
||||
Ok(()) => signals
|
||||
.set_command_feedback
|
||||
.set(format!("{}:块 -> {},并已写入本地草稿", message, label,)),
|
||||
Err(err) => signals.set_command_feedback.set(format!(
|
||||
"{}:块 -> {},但本地保存失败:{}",
|
||||
message, label, err,
|
||||
@@ -245,7 +244,7 @@ fn block_transform_submenu_view(
|
||||
handle_turn_into_action_click(editor, block_index, kind, label, signals);
|
||||
}
|
||||
>
|
||||
<span class="block-drag-menu-icon material-symbols-outlined">{icon}</span>
|
||||
<span class="block-drag-menu-icon material-symbols-outlined" data-icon=icon></span>
|
||||
<span>{label}</span>
|
||||
<span class="block-drag-menu-shortcut">{shortcut}</span>
|
||||
</button>
|
||||
@@ -331,7 +330,7 @@ fn block_transform_submenu_view(
|
||||
handle_folded_heading_click(editor, block_index, action, signals);
|
||||
}
|
||||
>
|
||||
<span class="block-drag-menu-icon material-symbols-outlined">{action.icon}</span>
|
||||
<span class="block-drag-menu-icon material-symbols-outlined" data-icon=action.icon></span>
|
||||
<span>{action.label}</span>
|
||||
</button>
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
//! Unified icon helpers — Material Symbols ligatures for all editor runtime icons.
|
||||
//!
|
||||
//! Every icon rendered in the leptos-tiptap editor shell should flow through
|
||||
//! `material_icon()` or consume `ICON_MAP` so that the set of Material Symbols
|
||||
//! ligatures stays centralised and we can swap font providers later.
|
||||
//! `material_icon()` or consume `ICON_MAP` so that icon names stay centralised
|
||||
//! and the host stylesheet can render local fallback masks without leaking
|
||||
//! Material Symbols ligature text.
|
||||
|
||||
use leptos::prelude::*;
|
||||
|
||||
/// Semantic name → Material Symbols ligature.
|
||||
/// Semantic name → icon identifier.
|
||||
///
|
||||
/// Keys are stable semantic identifiers; values are the literal text content
|
||||
/// that `material-symbols-outlined` will turn into a glyph via ligature.
|
||||
/// Keys are stable semantic identifiers; values are the `data-icon` identifier
|
||||
/// consumed by the host stylesheet.
|
||||
pub(crate) const ICON_MAP: &[(&str, &str)] = &[
|
||||
("heading_1", "looks_one"),
|
||||
("heading_2", "looks_two"),
|
||||
@@ -75,10 +76,10 @@ pub(crate) fn icon_ligature(name: &str) -> Option<&'static str> {
|
||||
|
||||
/// Render a `<span class="material-symbols-outlined">` icon.
|
||||
///
|
||||
/// The `name` parameter must be a Material Symbols ligature name
|
||||
/// The `name` parameter must be a known icon identifier
|
||||
/// (e.g. `"auto_awesome"`, `"chevron_right"`, `"looks_one"`).
|
||||
pub(crate) fn material_icon(name: &'static str) -> impl IntoView {
|
||||
view! {
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{name}</span>
|
||||
<span class="material-symbols-outlined" data-icon=name aria-hidden="true"></span>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,12 +83,8 @@ fn render_slash_shortcut(shortcut: &str) -> impl IntoView {
|
||||
}
|
||||
}
|
||||
|
||||
fn filtered_slash_intro_view(
|
||||
query: &str,
|
||||
command_feedback: WriteSignal<String>,
|
||||
) -> impl IntoView {
|
||||
let show_turn_into = !query.is_empty()
|
||||
&& ("zhw".contains(query) || "转换为".contains(query));
|
||||
fn filtered_slash_intro_view(query: &str, command_feedback: WriteSignal<String>) -> impl IntoView {
|
||||
let show_turn_into = !query.is_empty() && ("zhw".contains(query) || "转换为".contains(query));
|
||||
let show_page = !query.is_empty() && ("ym".contains(query) || "页面".contains(query));
|
||||
|
||||
if show_turn_into || show_page {
|
||||
@@ -213,9 +209,7 @@ fn handle_slash_item_click(
|
||||
}
|
||||
Err(err) => {
|
||||
signals.set_slash_open.set(false);
|
||||
signals
|
||||
.command_feedback
|
||||
.set(format!("命令执行失败:{err}"));
|
||||
signals.command_feedback.set(format!("命令执行失败:{err}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -282,7 +276,7 @@ pub(crate) fn slash_menu_view(props: SlashMenuViewProps) -> impl IntoView {
|
||||
}
|
||||
>
|
||||
<span class="slash-item-row">
|
||||
<span class="slash-item-icon material-symbols-outlined">{icon}</span>
|
||||
<span class="slash-item-icon material-symbols-outlined" data-icon=icon></span>
|
||||
<span class="slash-item-copy">
|
||||
<strong>{label}</strong>
|
||||
<span>{description}</span>
|
||||
|
||||
Reference in New Issue
Block a user