mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-02 17:16:52 +00:00
Remove module function wrapper and add matching configurations for dprint and eslint (#7596)
* remove blks first try * dprint.json seems to be OK, some forgotten functions * add some more space-after-keyword settings * server remove blks * add **/files to dprint exclude * dprint.js fixes a typo * add boot.js and bootprefix.js to dprint exclude * dprint change dprint.json * add dprint fmt as script * remove jslint comments * fix whitespace * fix whitespace * remove function-wrapper from geospatial plugin * fix whitespace * add function wrapper to dyannotate-startup * remove dpring.json
This commit is contained in:
@@ -8,10 +8,7 @@ ENEX file deserializer
|
||||
For details see: https://blog.evernote.com/tech/2013/08/08/evernote-export-format-enex/
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
// DOMParser = require("$:/plugins/tiddlywiki/xmldom/dom-parser").DOMParser;
|
||||
@@ -136,4 +133,18 @@ function fixAttachmentReference(contentNode, md5Hash, mimeType, name) {
|
||||
}
|
||||
|
||||
|
||||
})();
|
||||
function fixAttachmentReference(contentNode, md5Hash, mimeType, name) {
|
||||
if(!contentNode) return;
|
||||
var mediaNode = contentNode.querySelector('en-media[hash="' + md5Hash + '"]');
|
||||
if(!name) {
|
||||
throw new Error("name is empty for resource hash" + md5Hash);
|
||||
}
|
||||
if(!mediaNode) return;
|
||||
if(mimeType.indexOf("image/") === 0) {
|
||||
// find en-media node, replace with image syntax
|
||||
mediaNode.parentNode.replaceChild($tw.utils.domMaker("p", {text: "[img["+ name + "]]"}), mediaNode);
|
||||
} else {
|
||||
// For other than image attachments, we make a link to the tiddler
|
||||
mediaNode.parentNode.replaceChild($tw.utils.domMaker("p", {text: "[["+ name + "]]"}), mediaNode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user