refactor: split document pane runtime
This commit is contained in:
@@ -855,6 +855,20 @@ pub async fn document_conflict_panel_runtime_asset() -> Response {
|
||||
.unwrap_or_else(|_| Response::new(Body::empty()))
|
||||
}
|
||||
|
||||
pub async fn document_pane_runtime_asset() -> Response {
|
||||
const JS: &str = include_str!("../../browser/document-pane-runtime.js");
|
||||
Response::builder()
|
||||
.status(StatusCode::OK)
|
||||
.header(
|
||||
header::CONTENT_TYPE,
|
||||
"application/javascript; charset=utf-8",
|
||||
)
|
||||
.header(header::CACHE_CONTROL, "no-store")
|
||||
.header(HEADER_MNOTE_WEB_OWNER, "mnote-web")
|
||||
.body(Body::from(JS))
|
||||
.unwrap_or_else(|_| Response::new(Body::empty()))
|
||||
}
|
||||
|
||||
pub async fn document_tiptap_conversion_runtime_asset() -> Response {
|
||||
const JS: &str = include_str!("../../browser/document-tiptap-conversion-runtime.js");
|
||||
Response::builder()
|
||||
@@ -1292,6 +1306,7 @@ mod tests {
|
||||
|
||||
const DOCUMENT_EDITOR_ADAPTER_RUNTIME_JS: &str =
|
||||
include_str!("../../browser/document-editor-adapter-runtime.js");
|
||||
const DOCUMENT_PANE_RUNTIME_JS: &str = include_str!("../../browser/document-pane-runtime.js");
|
||||
const DOCUMENT_TIPTAP_CONVERSION_RUNTIME_JS: &str =
|
||||
include_str!("../../browser/document-tiptap-conversion-runtime.js");
|
||||
|
||||
@@ -2041,6 +2056,9 @@ mod tests {
|
||||
assert!(DOCUMENT_EDITOR_ADAPTER_RUNTIME_JS.contains("PANES_BOOTSTRAP_ID"));
|
||||
assert!(DOCUMENT_EDITOR_ADAPTER_RUNTIME_JS.contains("ROOT_SELECTOR"));
|
||||
assert!(DOCUMENT_EDITOR_ADAPTER_RUNTIME_JS.contains("BRIDGE_PROTOCOL"));
|
||||
assert!(DOCUMENT_EDITOR_ADAPTER_RUNTIME_JS.contains("document-pane-runtime.js"));
|
||||
assert!(DOCUMENT_PANE_RUNTIME_JS.contains("openDocumentInSecondaryPane"));
|
||||
assert!(DOCUMENT_PANE_RUNTIME_JS.contains("buildPaneRuntime"));
|
||||
assert!(
|
||||
DOCUMENT_EDITOR_ADAPTER_RUNTIME_JS.contains("document-tiptap-conversion-runtime.js")
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user