no modal for local doc

This commit is contained in:
Dongdong Zhou 2024-04-02 22:11:50 +01:00
parent d66b3c7cff
commit f9742f9e0f
2 changed files with 9 additions and 4 deletions

View File

@ -344,10 +344,15 @@ pub fn styling(self: &Rc<Doc>) -> Rc<DocStyling> {
/// Create an [`Editor`] instance from this [`Doc`]. Note that this needs to be registered
/// appropriately to create the [`EditorData`] and such.
pub fn create_editor(self: &Rc<Doc>, cx: Scope, id: EditorId) -> Editor {
pub fn create_editor(
self: &Rc<Doc>,
cx: Scope,
id: EditorId,
is_local: bool,
) -> Editor {
let common = &self.common;
let config = common.config.get_untracked();
let modal = config.core.modal;
let modal = config.core.modal && !is_local;
let register = common.register;
// TODO: we could have these Rcs created once and stored somewhere, maybe on

View File

@ -248,7 +248,7 @@ pub fn new_local_id(
) -> Self {
let cx = cx.create_child();
let doc = Rc::new(Doc::new_local(cx, editors, common.clone()));
let editor = doc.create_editor(cx, editor_id);
let editor = doc.create_editor(cx, editor_id, true);
Self::new(cx, editor, None, None, None, common)
}
@ -262,7 +262,7 @@ pub fn new_doc(
confirmed: Option<RwSignal<bool>>,
common: Rc<CommonData>,
) -> Self {
let editor = doc.create_editor(cx, EditorId::next());
let editor = doc.create_editor(cx, EditorId::next(), false);
Self::new(cx, editor, editor_tab_id, diff_editor_id, confirmed, common)
}