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:
parent
a0d2392f01
commit
d695fca301
17
core/modules/editor/operations/text/focus-editor.js
Normal file
17
core/modules/editor/operations/text/focus-editor.js
Normal 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;
|
||||
};
|
||||
|
||||
})();
|
@ -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>>>
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user