mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +00:00
Update typedblock parser to use new widget mechanism
This commit is contained in:
parent
d84e398d7a
commit
5610efff01
@ -28,6 +28,8 @@ $$$
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var widget = require("$:/core/modules/new_widgets/widget.js");
|
||||||
|
|
||||||
exports.name = "typedblock";
|
exports.name = "typedblock";
|
||||||
exports.types = {block: true};
|
exports.types = {block: true};
|
||||||
|
|
||||||
@ -63,10 +65,13 @@ exports.parse = function() {
|
|||||||
return parser.tree;
|
return parser.tree;
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, render to the rendertype and return in a <PRE> tag
|
// Otherwise, render to the rendertype and return in a <PRE> tag
|
||||||
var renderTree = new $tw.WikiRenderTree(parser,{wiki: $tw.wiki, document: $tw.document});
|
var parseTreeNode = parser ? {type: "widget", children: parser.tree} : undefined,
|
||||||
renderTree.execute();
|
widgetNode = new widget.widget(parseTreeNode,{
|
||||||
|
wiki: $tw.wiki,
|
||||||
|
document: $tw.document
|
||||||
|
});
|
||||||
var container = $tw.document.createElement("div");
|
var container = $tw.document.createElement("div");
|
||||||
renderTree.renderInDom(container);
|
widgetNode.render(container,null);
|
||||||
var text = renderType === "text/html" ? container.innerHTML : container.textContent;
|
var text = renderType === "text/html" ? container.innerHTML : container.textContent;
|
||||||
return [{
|
return [{
|
||||||
type: "element",
|
type: "element",
|
||||||
|
Loading…
Reference in New Issue
Block a user