mirror of
https://gitlab.com/octtspacc/OcttKB
synced 2025-06-06 00:29:12 +02:00
OcttKB Cross-Repo Sync (HTML to Raw)
This commit is contained in:
@ -0,0 +1,58 @@
|
||||
/*\
|
||||
title: $:/plugins/danielo515/2click2edit/ClickListener.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
This widgets adds an double click event listener to its parent
|
||||
|
||||
\*/
|
||||
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
||||
var ClickListener = function(parseTreeNode,options) {
|
||||
this.initialise(parseTreeNode,options);
|
||||
};
|
||||
|
||||
/*
|
||||
Inherit from the base widget class
|
||||
*/
|
||||
ClickListener.prototype = new Widget();
|
||||
|
||||
/*
|
||||
Render this widget into the DOM
|
||||
*/
|
||||
ClickListener.prototype.render = function(parent,nextSibling) {
|
||||
this.parentDomNode = parent;
|
||||
this.execute();
|
||||
var self = this;
|
||||
/*Since the event listener have been added to the parent, the "this" property is pointing to the
|
||||
wrong object, we should call our edit function with our widget object set as the this property.*/
|
||||
parent.addEventListener("dblclick",function(event){self.editTiddler.call(self,event)});
|
||||
};
|
||||
|
||||
ClickListener.prototype.editTiddler = function(event) {
|
||||
this.dispatchEvent({type: "tm-edit-tiddler", param: this.getVariable("currentTiddler")});
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
*/
|
||||
ClickListener.prototype.execute = function() {
|
||||
};
|
||||
|
||||
/*
|
||||
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
|
||||
*/
|
||||
ClickListener.prototype.refresh = function(changedTiddlers) {
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.click = ClickListener;
|
||||
|
||||
})();
|
@ -0,0 +1,3 @@
|
||||
module-type: widget
|
||||
title: $:/plugins/danielo515/2click2edit/ClickListener.js
|
||||
type: application/javascript
|
@ -0,0 +1,7 @@
|
||||
title: $:/plugins/danielo515/2click2edit/readme
|
||||
|
||||
This plugin adds the ability to edit tiddlers by double clicking on its body.
|
||||
Just try to edit any tiddler shown here by double clicking on it.
|
||||
|
||||
This can be considered a fast solution. It is only to fill the gap until TiddlyWiki adds support
|
||||
for it officially.
|
@ -0,0 +1,5 @@
|
||||
tags: $:/tags/ViewTemplate
|
||||
title: $:/plugins/danielo515/2click2edit/ui/ViewTemplate
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$click>
|
13
Wiki-OcttKB/plugins/2click2edit/plugin.info
Normal file
13
Wiki-OcttKB/plugins/2click2edit/plugin.info
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"bag": "default",
|
||||
"revision": "0",
|
||||
"version": "0.1",
|
||||
"title": "$:/plugins/danielo515/2click2edit",
|
||||
"source": "https://github.com/danielo515/TW5-2click2edit",
|
||||
"plugin-type": "plugin",
|
||||
"list": "readme",
|
||||
"description": "double click to edit tiddlers",
|
||||
"dependents": "",
|
||||
"core-version": ">=5.1.0",
|
||||
"author": "Danielo Rodriguez"
|
||||
}
|
Reference in New Issue
Block a user