mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-06-05 12:12:23 +00:00
fix: link may not have attribute and children
This commit is contained in:
@@ -51,11 +51,11 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree,serialize) {
|
||||
// Check if the link is suppressed
|
||||
var isSuppressed = tree.children[0].text.substr(0,1) === "~";
|
||||
// Check if the link is suppressed. Tree may only have text, no children and attributes
|
||||
var isSuppressed = tree.children && tree.children[0].text.substr(0,1) === "~";
|
||||
var serialized = isSuppressed ? "~" : "";
|
||||
// Append the link text
|
||||
serialized += tree.attributes.to.value;
|
||||
serialized += tree.attributes ? tree.attributes.to.value : tree.text;
|
||||
return serialized;
|
||||
};
|
||||
|
||||
|
||||
@@ -66,10 +66,10 @@ exports.parse = function() {
|
||||
};
|
||||
|
||||
exports.serialize = function(tree,serialize) {
|
||||
var isSuppressed = tree.children[0].text.substr(0,1) === $tw.config.textPrimitives.unWikiLink;
|
||||
var isSuppressed = tree.children && tree.children[0].text.substr(0,1) === $tw.config.textPrimitives.unWikiLink;
|
||||
|
||||
var serialized = isSuppressed ? $tw.config.textPrimitives.unWikiLink : "";
|
||||
serialized += tree.attributes.to.value;
|
||||
serialized += tree.attributes ? tree.attributes.to.value : tree.text;
|
||||
return serialized;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user