diff --git a/code-input.d.ts b/code-input.d.ts index e97206a..e50e14a 100644 --- a/code-input.d.ts +++ b/code-input.d.ts @@ -129,15 +129,16 @@ export namespace plugins { // ESM-SUPPORT-START-PLUGIN-find-and-replace Do not (re)move this - it's needed for ESM generation /** - * Add Find-and-Replace (Ctrl+F for find, Ctrl+H for replace by default) functionality to the code editor. + * Add Find-and-Replace (Ctrl/Cmd+F for find, Ctrl+H for replace by default) functionality to the code editor. * Files: find-and-replace.js / find-and-replace.css */ class FindAndReplace extends Plugin { /** - * Create a find-and-replace command plugin to pass into a template - * @param {boolean} useCtrlF Should Ctrl+F be overriden for find-and-replace find functionality? Either way, you can also trigger it yourself using (instance of this plugin)`.showPrompt(code-input element, false)`. + * Create a find-and-replace command plugin to pass into a template. To ensure keyboard shortcuts remain intuitive, set the alwaysCtrl parameter to false. + * @param {boolean} useCtrlF Should Ctrl/Cmd+F be overriden for find-and-replace find functionality? Either way, you can also trigger it yourself using (instance of this plugin)`.showPrompt(code-input element, false)`. * @param {boolean} useCtrlH Should Ctrl+H be overriden for find-and-replace replace functionality? Either way, you can also trigger it yourself using (instance of this plugin)`.showPrompt(code-input element, true)`. * @param {Object} instructionTranslations: user interface string keys mapped to translated versions for localisation. Look at the find-and-replace.js source code for the English text. + * @param {boolean} alwaysCtrl Setting this to false makes the keyboard shortcuts follow the operating system while avoiding clashes (right now: Cmd+F/Ctrl+H on Apple, Ctrl+F/Ctrl+H otherwise.) and is recommended; true forces Ctrl+F/Ctrl+H and is default for backwards compatibility. */ constructor(useCtrlF?: boolean, useCtrlH?: boolean, instructionTranslations?: { @@ -159,7 +160,8 @@ export namespace plugins { replaceAction?: string; replaceAllActionShort?: string; replaceAllAction?: string - } + }, + alwaysCtrl?: boolean ); /** * Show a find-and-replace dialog. @@ -172,13 +174,13 @@ export namespace plugins { // ESM-SUPPORT-START-PLUGIN-go-to-line Do not (re)move this - it's needed for ESM generation /** - * Add basic Go-To-Line (ctrl-G by default) functionality to the code editor. + * Add Go-To-Line (Ctrl/Cmd+G by default) functionality to the code editor. * Files: go-to-line.js / go-to-line.css */ class GoToLine extends Plugin { /** - * Create a go-to-line command plugin to pass into a template - * @param {boolean} useCtrlG Should Ctrl+G be overriden for go-to-line functionality? Either way, you can trigger it yourself using (instance of this plugin)`.showPrompt(code-input element)`. + * Create a go-to-line command plugin to pass into a template. + * @param {boolean} useCtrlG Should Ctrl/Cmd+G be overriden for go-to-line functionality? Either way, you can trigger it yourself using (instance of this plugin)`.showPrompt(code-input element)`. * @param {Object} instructionTranslations: user interface string keys mapped to translated versions for localisation. Look at the go-to-line.js source code for the English text. */ constructor(useCtrlG?: boolean, @@ -190,7 +192,8 @@ export namespace plugins { guidanceColumnRange?: (line: Number, current: Number, max: Number) => string; guidanceValidLine?: (line: Number) => string; guidanceValidColumn?: (line: Number, column: Number) => string; - }); + }, + ); /** * Show a search-like dialog prompting line number. * @param {codeInput.CodeInput} codeInput the `` element. diff --git a/docs/i18n/_index.md b/docs/i18n/_index.md index 95e0159..0408fe4 100644 --- a/docs/i18n/_index.md +++ b/docs/i18n/_index.md @@ -20,7 +20,7 @@ code-input:not(.code-input_registered)::after { It is only present for debugging and explanatory purposes when highlighting cannot be seen, and should not contain important or specific information about the editor state; if you need such information, especially for screen reader users, add separate text to your application which disappears after registering the code-input without errors. -**Plugins** sometimes come with user interface features (e.g. the find-and-replace dialog) which contain text to be translated. The text is provided as an extra argument to the plugin constructor containing translated strings or functions to produce them for each translation key, with the keys and their English values found in either the `code-input.d.ts` or the plugin's source code file. Here's an example: +**Plugins** sometimes come with user interface features (e.g. the find-and-replace dialog) which contain text to be translated. The text is provided as an argument to the plugin constructor containing translated strings or functions to produce them for each translation key, with the keys and their English values found in either the `code-input.d.ts` or the plugin's source code file. Here's an example: ```javascript // CC-BY; Attribution: Translated by Oliver Geer with some help from English Wiktionary let findAndReplaceTranslations = { @@ -45,7 +45,7 @@ let findAndReplaceTranslations = { }; // ... // passed when the plugin is constructed: -new codeInput.plugins.FindAndReplace(true, true, findAndReplaceTranslations), +new codeInput.plugins.FindAndReplace(true, true, findAndReplaceTranslations, false), ``` ## Other diff --git a/docs/plugins/_index.md b/docs/plugins/_index.md index 23deee2..c631d03 100644 --- a/docs/plugins/_index.md +++ b/docs/plugins/_index.md @@ -144,8 +144,10 @@ Right now, you can only add one plugin of each type (e.g. one SelectTokenCallbac