OcttKB Cross-Repo Sync (HTML to Raw)

This commit is contained in:
2023-11-03 22:10:11 +00:00
parent c93c5a6f48
commit 8a859c31c8
38 changed files with 187 additions and 38 deletions

View File

@ -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;
})();

View File

@ -0,0 +1,3 @@
module-type: widget
title: $:/plugins/danielo515/2click2edit/ClickListener.js
type: application/javascript

View File

@ -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.

View File

@ -0,0 +1,5 @@
tags: $:/tags/ViewTemplate
title: $:/plugins/danielo515/2click2edit/ui/ViewTemplate
type: text/vnd.tiddlywiki
<$click>

View 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"
}