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,64 @@
|
||||
/*\
|
||||
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.*/
|
||||
|
||||
/* OcttKB: edit this to work with 3 clicks instead of 2 */
|
||||
window.addEventListener('click', function(ev){
|
||||
if (ev.detail === 3) {
|
||||
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.tripleclickedit = ClickListener;
|
||||
|
||||
})();
|
@ -0,0 +1,7 @@
|
||||
created: 20231103222110593
|
||||
creator: Octt
|
||||
modified: 20231103222326612
|
||||
modifier: Octt
|
||||
module-type: widget
|
||||
title: $:/plugins/danielo515/2click2edit/ClickListener.js
|
||||
type: application/javascript
|
@ -0,0 +1,15 @@
|
||||
created: 20231103222340488
|
||||
creator: Octt
|
||||
modified: 20231103222502294
|
||||
modifier: Octt
|
||||
title: $:/plugins/danielo515/2click2edit/readme
|
||||
|
||||
Edited for the [[OcttKB]], to work with 3 clicks instead of 2.
|
||||
|
||||
Original readme below:
|
||||
|
||||
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.
|
Reference in New Issue
Block a user