Skip to content

Commit

Permalink
2.4.0-rc-1
Browse files Browse the repository at this point in the history
  • Loading branch information
zsviczian committed Aug 27, 2024
1 parent 89172a8 commit eee2649
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 7 deletions.
2 changes: 1 addition & 1 deletion manifest-beta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.4.0-beta-10",
"version": "2.4.0-rc-1",
"minAppVersion": "1.1.6",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",
Expand Down
5 changes: 4 additions & 1 deletion src/ExcalidrawData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ export const REGEX_TAGS = {
export const REGEX_LINK = {
//![[link|alias]] [alias](link){num}
// 1 2 3 4 5 67 8 9
EXPR: /(!)?(\[\[([^|\]]+)\|?([^\]]+)?]]|\[([^\]]*)]\(([^)]*)\))(\{(\d+)\})?/g, //https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/187
//EXPR: /(!)?(\[\[([^|\]]+)\|?([^\]]+)?]]|\[([^\]]*)]\(([^)]*)\))(\{(\d+)\})?/g, //https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/187
// 1 2 3 4 5 67 8 9
EXPR: /(!)?(\[\[([^|\]]+)\|?([^\]]+)?]]|\[([^\]]*)]\(((?:[^\(\)]|\([^\(\)]*\))*)\))(\{(\d+)\})?/g, //https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1963

getResList: (text: string): IteratorResult<RegExpMatchArray, any>[] => {
const res = text.matchAll(REGEX_LINK.EXPR);
let parts: IteratorResult<RegExpMatchArray, any>;
Expand Down
13 changes: 10 additions & 3 deletions src/customEmbeddable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,14 @@ function RenderObsidianView(
}
} else if (leafRef.current?.node) {
//Handle canvas node
containerRef.current?.removeClasses(["is-editing", "is-focused"]);
view.canvasNodeFactory.stopEditing(leafRef.current.node);
if(view.plugin.settings.markdownNodeOneClickEditing && !containerRef.current?.hasClass("is-editing")) {
const newTheme = getTheme(view, themeRef.current);
containerRef.current?.addClasses(["is-editing", "is-focused"]);
view.canvasNodeFactory.startEditing(leafRef.current.node, newTheme);
} else {
containerRef.current?.removeClasses(["is-editing", "is-focused"]);
view.canvasNodeFactory.stopEditing(leafRef.current.node);
}
}
}, [
containerRef,
Expand All @@ -428,7 +434,8 @@ function RenderObsidianView(
element,
view,
isEditingRef,
view.canvasNodeFactory
view.canvasNodeFactory,
themeRef.current
]);

return null;
Expand Down
6 changes: 5 additions & 1 deletion src/lang/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,11 @@ FILENAME_HEAD: "Filename",
EMBED_TOEXCALIDRAW_DESC: "In the Embed Files section of Excalidraw Settings, you can configure how various files are embedded into Excalidraw. This includes options for embedding interactive markdown files, PDFs, and markdown files as images.",
MD_HEAD: "Embed markdown into Excalidraw as image",
MD_EMBED_CUSTOMDATA_HEAD_NAME: "Interactive Markdown Files",
MD_EMBED_CUSTOMDATA_HEAD_DESC: `These settings will only effect future embeds. Current embeds remain unchanged. The theme setting of embedded frames is under the "Excalidraw appearance and behavior" section.`,
MD_EMBED_CUSTOMDATA_HEAD_DESC: `The below settings will only effect future embeds. Current embeds remain unchanged. The theme setting of embedded frames is under the "Excalidraw appearance and behavior" section.`,
MD_EMBED_SINGLECLICK_EDIT_NAME: "Single click to edit embedded markdown",
MD_EMBED_SINGLECLICK_EDIT_DESC:
"Single click on an embedded markdown file to edit it. " +
"When turned off, the markdown file will first open in preview mode, then switch to edit mode when you click on it again.",
MD_TRANSCLUDE_WIDTH_NAME: "Default width of a transcluded markdown document",
MD_TRANSCLUDE_WIDTH_DESC:
"The width of the markdown page. This affects the word wrapping when transcluding longer paragraphs, and the width of " +
Expand Down
23 changes: 22 additions & 1 deletion src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export interface ExcalidrawSettings {
COLOR: string,
};
embeddableMarkdownDefaults: EmbeddableMDCustomProps;
markdownNodeOneClickEditing: boolean;
canvasImmersiveEmbed: boolean,
startupScriptPath: string,
openAIAPIToken: string,
Expand Down Expand Up @@ -366,6 +367,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
borderOpacity: 0,
filenameVisible: false,
},
markdownNodeOneClickEditing: false,
canvasImmersiveEmbed: true,
startupScriptPath: "",
openAIAPIToken: "",
Expand Down Expand Up @@ -2125,7 +2127,26 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
text: t("MD_EMBED_CUSTOMDATA_HEAD_NAME"),
cls: "excalidraw-setting-h3",
});
detailsEl.createEl("span", {text: t("MD_EMBED_CUSTOMDATA_HEAD_DESC")});

new Setting(detailsEl)
.setName(t("MD_EMBED_SINGLECLICK_EDIT_NAME"))
.setDesc(fragWithHTML(t("MD_EMBED_SINGLECLICK_EDIT_DESC")))
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.markdownNodeOneClickEditing)
.onChange(async (value) => {
this.plugin.settings.markdownNodeOneClickEditing = value;
this.applySettingsUpdate();
})
);

detailsEl.createEl("hr", { cls: "excalidraw-setting-hr" });
detailsEl.createEl("span", {}, (el) => {
el.innerHTML = t("MD_EMBED_CUSTOMDATA_HEAD_DESC");
});




new EmbeddalbeMDFileCustomDataSettingsComponent(
detailsEl,
Expand Down
4 changes: 4 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -625,4 +625,8 @@ textarea.excalidraw-wysiwyg, .excalidraw input {
.excalidraw-rank svg {
height: 8rem;
width: 8rem;
}

.excalidraw .color-picker-content input[type="color"] {
filter: var(--theme-filter);
}

0 comments on commit eee2649

Please sign in to comment.