mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Include double square brackets when dragging titles
Dragging a tiddler link into a tiddler editor, or outside the browser into another app, will now add double square brackets around the title if it includes spaces. Suggested by @tgirod. I’m not 100% sure about this change. It breaks one habit that I had developed: typing `[[sometext|]]` and then dragging a title in between the vertical bar and the first closing square bracket. What do others think?
This commit is contained in:
parent
0550efabf8
commit
335c470797
@ -154,15 +154,16 @@ LinkWidget.prototype.handleDragStartEvent = function(event) {
|
||||
// Then the data
|
||||
dataTransfer.clearData();
|
||||
var jsonData = this.wiki.getTiddlerAsJson(this.to),
|
||||
textData = this.wiki.getTiddlerText(this.to,"");
|
||||
textData = this.wiki.getTiddlerText(this.to,""),
|
||||
title = this.to.indexOf(" ") === -1 ? this.to : "[[" + this.to + "]]";
|
||||
// IE doesn't like these content types
|
||||
if(!$tw.browser.isIE) {
|
||||
dataTransfer.setData("text/vnd.tiddler",jsonData);
|
||||
dataTransfer.setData("text/plain",this.to);
|
||||
dataTransfer.setData("text/plain",title);
|
||||
dataTransfer.setData("text/x-moz-url","data:text/vnd.tiddler," + encodeURI(jsonData));
|
||||
}
|
||||
dataTransfer.setData("URL","data:text/vnd.tiddler," + encodeURI(jsonData));
|
||||
dataTransfer.setData("Text",this.to);
|
||||
dataTransfer.setData("Text",title);
|
||||
event.stopPropagation();
|
||||
} else {
|
||||
event.preventDefault();
|
||||
|
Loading…
Reference in New Issue
Block a user