Revert "Merge pull request #580 from i-c-u-p/patch-2"

This reverts commit cef882642e, reversing
changes made to 560807285f.
This commit is contained in:
Zsolt Viczian
2022-04-10 21:34:05 +02:00
parent 4b3c5e9859
commit 0a3d49408a
6 changed files with 37 additions and 37 deletions

View File

@@ -6,14 +6,14 @@ import {
EditorSuggestTriggerInfo,
TFile,
} from "obsidian";
import { FRONTMATTER_KEYS_INFO } from "./SuggesterInfo";
import { FRONTMATTER_KEYS_INFO } from "./SuggestorInfo";
import {
EXCALIDRAW_AUTOMATE_INFO,
EXCALIDRAW_SCRIPTENGINE_INFO,
} from "./SuggesterInfo";
} from "./SuggestorInfo";
import type ExcalidrawPlugin from "./main";
export class FieldSuggester extends EditorSuggest<string> {
export class FieldSuggestor extends EditorSuggest<string> {
plugin: ExcalidrawPlugin;
suggestType: "ea" | "excalidraw" | "utils";
latestTriggerInfo: EditorSuggestTriggerInfo;
@@ -28,7 +28,7 @@ export class FieldSuggester extends EditorSuggest<string> {
editor: Editor,
_: TFile,
): EditorSuggestTriggerInfo | null {
if (this.plugin.settings.fieldSuggester) {
if (this.plugin.settings.fieldSuggestor) {
const sub = editor.getLine(cursor.line).substring(0, cursor.ch);
const match =
sub.match(/^excalidraw-(.*)$/)?.[1] ??

View File

@@ -9,14 +9,14 @@ import {
FRONTMATTER_KEY_MD_STYLE,
} from "./Constants";
type SuggesterInfo = {
type SuggestorInfo = {
field: string;
code: string;
desc: string;
after: string;
};
export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
export const EXCALIDRAW_AUTOMATE_INFO: SuggestorInfo[] = [
{
field: "plugin",
code: null,
@@ -487,7 +487,7 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
},
];
export const EXCALIDRAW_SCRIPTENGINE_INFO: SuggesterInfo[] = [
export const EXCALIDRAW_SCRIPTENGINE_INFO: SuggestorInfo[] = [
{
field: "inputPrompt",
code: "inputPrompt: (header: string, placeholder?: string, value?: string, buttons?: [{caption:string, action:Function}]);",
@@ -505,7 +505,7 @@ export const EXCALIDRAW_SCRIPTENGINE_INFO: SuggesterInfo[] = [
},
];
export const FRONTMATTER_KEYS_INFO: SuggesterInfo[] = [
export const FRONTMATTER_KEYS_INFO: SuggestorInfo[] = [
{
field: "plugin",
code: null,

View File

@@ -96,8 +96,8 @@ export default {
TEMPLATE_DESC:
"Full filepath to the Excalidraw template. " +
"E.g.: If your template is in the default Excalidraw folder and it's name is " +
"Template.md, the setting would be: Excalidraw/Template.md (or just Excalidraw/Template - you may omit the .md file extension). " +
"If you are using Excalidraw in compatibility mode, then your template must be a legacy Excalidraw file as well " +
"Template.md, the setting would be: Excalidraw/Template.md (or just Excalidraw/Template - you may ommit the .md file extension). " +
"If you are using Excalidraw in compatibility mode, then your template must be a legacy excalidraw file as well " +
"such as Excalidraw/Template.excalidraw.",
SCRIPT_FOLDER_NAME: "Excalidraw Automate script folder",
SCRIPT_FOLDER_DESC:
@@ -164,10 +164,10 @@ export default {
"If this option is enabled open Excalidraw pane will switch to light/dark mode when Obsidian theme changes. ",
DEFAULT_OPEN_MODE_NAME: "Default mode when opening Excalidraw",
DEFAULT_OPEN_MODE_DESC:
"Specifies the mode how Excalidraw opens: Normal, Zen, or View mode. You may also set this behavior on a file level by " +
"Specifies the mode how Excalidraw opens: Normal, Zen, or View mode. You may also set this behaviour on a file level by " +
"adding the excalidraw-default-mode frontmatter key with a value of: normal,view, or zen to your document.",
DEFAULT_PEN_MODE_NAME: "Pen mode",
DEFAULT_PEN_MODE_DESC: "Should pen mode be automatically enabled when opening Excalidraw?",
DEFAULT_PEN_MODE_DESC: "Should pen mode be automatically enabled when opening excalidraw?",
ZOOM_TO_FIT_NAME: "Zoom to fit on view resize",
ZOOM_TO_FIT_DESC: "Zoom to fit drawing when the pane is resized",
ZOOM_TO_FIT_MAX_LEVEL_NAME: "Zoom to fit max ZOOM level",
@@ -204,7 +204,7 @@ export default {
}${FRONTMATTER_KEY_CUSTOM_URL_PREFIX}: "🌐 "</code> to the file's frontmatter.`,
HOVERPREVIEW_NAME: "Hover preview without CTRL/CMD key",
HOVERPREVIEW_DESC:
"Toggle On: Hover preview for [[wiki links]] is shown immediately, without the need to hold the CTRL/CMD key.<br>Toggle Off: Hover preview is shown only when you hold the CTRL/CMD key while hovering the link.",
"Toggle On: Hover preview for [[wiki links]] is shown immedately, without the need to hold the CTRL/CMD key.<br>Toggle Off: Hover preview is shown only when you hold the CTRL/CMD key while hovering the link.",
LINKOPACITY_NAME: "Opacity of link icon",
LINKOPACITY_DESC:
"Opacity of the link indicator icon in the top right corner of an element. 1 is opaque, 0 is transparent.",
@@ -242,7 +242,7 @@ export default {
MD_TRANSCLUDE_HEIGHT_NAME:
"Default maximum height of a transcluded markdown document",
MD_TRANSCLUDE_HEIGHT_DESC:
"The embedded image will be as high as the markdown text requires, but not higher than this value. " +
"The embedded image will be as high as the markdown text requries, but not higher than this value. " +
"You can override this value by editing the embedded image link in markdown view mode with the following syntax <code>[[filename#^blockref|WIDTHxMAXHEIGHT]]</code>.",
MD_DEFAULT_FONT_NAME:
"The default font typeface to use for embedded markdown files.",
@@ -264,11 +264,11 @@ export default {
MD_CSS_DESC:
"The filename of the CSS to apply to markdown embeds. Provide the filename with extension (e.g. 'md-embed.css'). The css file may also be a plain " +
"markdown file (e.g. 'md-embed-css.md'), just make sure the content is written using valid css syntax. " +
"If you need to look at the HTML code you are applying the CSS to, then open Obsidian Developer Console (CTRL+SHIFT+i) and type in the following command: " +
"If you need to look at the HTML code you are applying the CSS to, then open Obsidian Developer Console (CTRL+SHIFT+i) and type in the follwoing command: " +
'"ExcalidrawAutomate.mostRecentMarkdownSVG". This will display the most recent SVG generated by Excalidraw. ' +
"Setting the font-family in the css is has limitations. By default only your operating system's standard fonts are available (see README for details). " +
"You can add one custom font beyond that using the setting above. " +
'You can override this css setting by adding the following frontmatter-key to the embedded markdown file: "excalidraw-css: css_file_in_vault|css-snippet".',
'You can override this css setting by adding the following frontmatter-key to the embedded markdown file: "excalidraw-css: css_file_in_valut|css-snippet".',
EMBED_HEAD: "Embed & Export",
EMBED_REUSE_EXPORTED_IMAGE_NAME: "If found, use the already exported image for preview",
EMBED_REUSE_EXPORTED_IMAGE_DESC:
@@ -291,7 +291,7 @@ export default {
"<code>[[drawing.excalidraw|100x100]]</code> format.",
EMBED_TYPE_NAME: "Type of file to insert into the document",
EMBED_TYPE_DESC:
"When you embed an image into a document using the command palette this setting will specify if Excalidraw should embed the original Excalidraw file " +
"When you embed an image into a document using the command palette this setting will specify if Excalidraw should embed the original excalidraw file " +
"or a PNG or an SVG copy. You need to enable auto-export PNG / SVG (see below under Export Settings) for those image types to be available in the dropdown. For drawings that do not have a " +
"a corresponding PNG or SVG readily available the command palette action will insert a broken link. You need to open the original drawing and initiate export manually. " +
"This option will not autogenerate PNG/SVG files, but will simply reference the already existing files.",
@@ -320,8 +320,8 @@ export default {
EXPORT_SVG_DESC:
"Automatically create an SVG export of your drawing matching the title of your file. " +
"The plugin will save the *.SVG file in the same folder as the drawing. " +
"Embed the .svg file into your documents instead of Excalidraw making you embeds platform independent. " +
"While the auto-export switch is on, this file will get updated every time you edit the Excalidraw drawing with the matching name.",
"Embed the .svg file into your documents instead of excalidraw making you embeds platform independent. " +
"While the auto-export switch is on, this file will get updated every time you edit the excalidraw drawing with the matching name.",
EXPORT_PNG_NAME: "Auto-export PNG",
EXPORT_PNG_DESC: "Same as the auto-export SVG, but for *.PNG",
COMPATIBILITY_HEAD: "Compatibility features",
@@ -340,15 +340,15 @@ export default {
EXPERIMENTAL_HEAD: "Experimental features",
EXPERIMENTAL_DESC:
"Some of these setting will not take effect immediately, only when the File Explorer is refreshed, or Obsidian restarted.",
FIELD_SUGGESTER_NAME: "Enable Field Suggester",
FIELD_SUGGESTER_DESC:
"Field Suggester borrowed from Breadcrumbs and Templater plugins. The Field Suggester will show an autocomplete menu " +
FIELD_SUGGESTOR_NAME: "Enable Field Suggestor",
FIELD_SUGGESTOR_DESC:
"Field Suggestor borrowed from Breadcrumbs and Templater plugins. The Field Suggestor will show an autocomplete menu " +
"when you type <code>excalidraw-</code> or <code>ea.</code> with function description as hints on the individual items in the list.",
FILETYPE_NAME: "Display type (✏️) for excalidraw.md files in File Explorer",
FILETYPE_DESC:
"Excalidraw files will receive an indicator using the emoji or text defined in the next setting.",
"Excalidraw files will receive an indicator using the emojii or text defined in the next setting.",
FILETAG_NAME: "Set the type indicator for excalidraw.md files",
FILETAG_DESC: "The text or emoji to display as type indicator.",
FILETAG_DESC: "The text or emojii to display as type indicator.",
INSERT_EMOJI: "Insert an emoji",
LIVEPREVIEW_NAME: "Immersive image embedding in live preview editing mode",
LIVEPREVIEW_DESC:
@@ -358,13 +358,13 @@ export default {
ENABLE_FOURTH_FONT_NAME: "Enable fourth font option",
ENABLE_FOURTH_FONT_DESC:
"By turning this on, you will see a fourth font button on the properties panel for text elements. " +
"Files that use this fourth font will (partly) lose their platform independence. " +
"Depending on the custom font set in settings, they will look differently when loaded in another vault, or at a later time. " +
"Files that use this fourth font will (partly) lose their paltform independence. " +
"Depending on the cutom font set in settings, they will look differently when loaded in another vault, or at a later time. " +
"Also the 4th font will display as system default font on excalidraw.com, or other Excalidraw versions.",
FOURTH_FONT_NAME: "Forth font file",
FOURTH_FONT_DESC:
"Select a .ttf, .woff or .woff2 font file from your vault to use as the fourth font. " +
"If no file is selected, Excalidraw will use the Virgil font by default.",
"If no file is selected excalidraw will use the Virgil font by default.",
SCRIPT_SETTINGS_HEAD: "Settings for installed Scripts",
//openDrawings.ts

View File

@@ -331,8 +331,8 @@ export default {
EXPERIMENTAL_HEAD: "实验性功能",
EXPERIMENTAL_DESC:
"以下部分设置不会立即生效,需要刷新文件资源管理器或者重启 Obsidian 才会生效。",
FIELD_SUGGESTER_NAME: "开启 Field Suggester",
FIELD_SUGGESTER_DESC:
FIELD_SUGGESTOR_NAME: "开启 Field Suggestor",
FIELD_SUGGESTOR_DESC:
"开启后,当您在编辑器中输入 <code>excalidraw-</code> 或者 <code>ea.</code> 时,会弹出一个带有函数说明的自动补全提示菜单。<br>" +
"该功能借鉴了 Breadcrumbs 和 Templater 插件。",
FILETYPE_NAME: "在文件浏览器中为 excalidraw.md 文件添加类型标识符(如 ✏️)",

View File

@@ -91,7 +91,7 @@ import {
markdownPostProcessor,
observer,
} from "./MarkdownPostProcessor";
import { FieldSuggester } from "./FieldSuggester";
import { FieldSuggestor } from "./FieldSuggestor";
import { ReleaseNotes } from "./ReleaseNotes";
import { debug } from "./Utils";
@@ -181,7 +181,7 @@ export default class ExcalidrawPlugin extends Plugin {
this.registerCommands();
this.registerEventListeners();
this.initializeFourthFont();
this.registerEditorSuggest(new FieldSuggester(this));
this.registerEditorSuggest(new FieldSuggestor(this));
//inspiration taken from kanban:
//https://github.com/mgmeyers/obsidian-kanban/blob/44118e25661bff9ebfe54f71ae33805dc88ffa53/src/main.ts#L267

View File

@@ -66,7 +66,7 @@ export interface ExcalidrawSettings {
experimentalLivePreview: boolean;
experimentalEnableFourthFont: boolean;
experimantalFourthFont: string;
fieldSuggester: boolean;
fieldSuggestor: boolean;
//loadCount: number; //version 1.2 migration counter
drawingOpenCount: number;
library: string;
@@ -139,7 +139,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
experimentalLivePreview: true,
experimentalEnableFourthFont: false,
experimantalFourthFont: "Virgil",
fieldSuggester: true,
fieldSuggestor: true,
compatibilityMode: false,
//loadCount: 0,
drawingOpenCount: 0,
@@ -1098,13 +1098,13 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
this.containerEl.createEl("p", { text: t("EXPERIMENTAL_DESC") });
new Setting(containerEl)
.setName(t("FIELD_SUGGESTER_NAME"))
.setDesc(fragWithHTML(t("FIELD_SUGGESTER_DESC")))
.setName(t("FIELD_SUGGESTOR_NAME"))
.setDesc(fragWithHTML(t("FIELD_SUGGESTOR_DESC")))
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.fieldSuggester)
.setValue(this.plugin.settings.fieldSuggestor)
.onChange(async (value) => {
this.plugin.settings.fieldSuggester = value;
this.plugin.settings.fieldSuggestor = value;
this.applySettingsUpdate();
}),
);