Update typedblock parser to use new widget mechanism

print-window-tiddler
Jeremy Ruston 2013-10-27 22:53:22 +00:00
rodzic d84e398d7a
commit 5610efff01
1 zmienionych plików z 8 dodań i 3 usunięć

Wyświetl plik

@ -28,6 +28,8 @@ $$$
/*global $tw: false */
"use strict";
var widget = require("$:/core/modules/new_widgets/widget.js");
exports.name = "typedblock";
exports.types = {block: true};
@ -63,10 +65,13 @@ exports.parse = function() {
return parser.tree;
} else {
// Otherwise, render to the rendertype and return in a <PRE> tag
var renderTree = new $tw.WikiRenderTree(parser,{wiki: $tw.wiki, document: $tw.document});
renderTree.execute();
var parseTreeNode = parser ? {type: "widget", children: parser.tree} : undefined,
widgetNode = new widget.widget(parseTreeNode,{
wiki: $tw.wiki,
document: $tw.document
});
var container = $tw.document.createElement("div");
renderTree.renderInDom(container);
widgetNode.render(container,null);
var text = renderType === "text/html" ? container.innerHTML : container.textContent;
return [{
type: "element",