1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Add focus-editor text operation and use it where sensible (#6012)

* add and use focus-editor text operation

* add docs
This commit is contained in:
Simon Huber 2021-10-27 12:37:40 +02:00 committed by GitHub
parent a0d2392f01
commit d695fca301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,17 @@
/*\
title: $:/core/modules/editor/operations/text/focus-editor.js
type: application/javascript
module-type: texteditoroperation
Simply focus the Text editor
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports["focus-editor"] = function(event,operation) {
operation = null;
};
})();

View File

@ -13,7 +13,7 @@ title: $:/core/ui/EditorToolbar/link-dropdown
<$set name="userInput" value={{{ [<storeTitle>get[text]] }}}><$list filter="[<searchTiddler>get[text]!match<userInput>]" emptyMessage="""<$action-deletetiddler $filter="[<searchTiddler>] [<linkTiddler>] [<storeTitle>] [<searchListState>]"/>"""><$action-setfield $tiddler=<<searchTiddler>> text=<<userInput>>/><$action-setfield $tiddler=<<refreshTitle>> text="yes"/></$list></$set>
\end
\define cancel-search-actions() <$list filter="[<storeTitle>!has[text]] +[<searchTiddler>!has[text]]" emptyMessage="""<<cancel-search-actions-inner>>"""><$action-sendmessage $message="tm-edit-text-operation" $param="wrap-selection" prefix="" suffix=""/></$list>
\define cancel-search-actions() <$list filter="[<storeTitle>!has[text]] +[<searchTiddler>!has[text]]" emptyMessage="""<<cancel-search-actions-inner>>"""><$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/></$list>
\define external-link()
<$button class="tc-btn-invisible" style="width: auto; display: inline-block; background-colour: inherit;" actions=<<add-link-actions>>>

View File

@ -115,6 +115,8 @@ Inserts the text specified in <<.param "text">> at the caret position. If there
</div>
\end
\define focusEditorDescription() Simply focuses the Text Editor
A `tm-edit-text-operation` invokes one of the available operations on a __surrounding__ text editor. Therefore the message has to be dispatched within the editor in order for it to catch it. The following properties on the `event` object are required:
|!Name |!Description |
@ -137,6 +139,7 @@ At this point the following text operations have been implemented:
|<<.def "save-selection">>|<<saveSelectionDescription>> |
|<<.def "make-link">>|<<makeLinkDescription>> |
|<<.def "insert-text">>|<<insertTextDescription>>|
|<<.def "focus-editor">>|<<.from-version 5.2.0>> <<focusEditorDescription>> |
!Example