1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 10:29:54 +00:00

New text editor operation: save selection to a tiddler

This commit is contained in:
Jermolene 2018-06-29 15:09:51 +01:00
parent f54a0a11bc
commit bef3242075

View File

@ -0,0 +1,23 @@
/*\
title: $:/core/modules/editor/operations/text/save-selection.js
type: application/javascript
module-type: texteditoroperation
Text editor operation to save the current selection in a specified tiddler
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports["save-selection"] = function(event,operation) {
var tiddler = event.paramObject.tiddler,
field = event.paramObject.field || "text";
if(tiddler && field) {
this.wiki.setText(tiddler,field,null,operation.text.substring(operation.selStart,operation.selEnd));
}
};
})();