diff --git a/core/config/editor-type-mappings/image-gif.tid b/core/config/editor-type-mappings/image-gif.tid new file mode 100644 index 000000000..7f66c8434 --- /dev/null +++ b/core/config/editor-type-mappings/image-gif.tid @@ -0,0 +1,3 @@ +title: $:/config/EditorTypeMappings/image/gif + +bitmap \ No newline at end of file diff --git a/core/config/editor-type-mappings/image-jpeg.tid b/core/config/editor-type-mappings/image-jpeg.tid new file mode 100644 index 000000000..02a0943ca --- /dev/null +++ b/core/config/editor-type-mappings/image-jpeg.tid @@ -0,0 +1,3 @@ +title: $:/config/EditorTypeMappings/image/jpeg + +bitmap \ No newline at end of file diff --git a/core/config/editor-type-mappings/image-jpg.tid b/core/config/editor-type-mappings/image-jpg.tid new file mode 100644 index 000000000..d1eda17c7 --- /dev/null +++ b/core/config/editor-type-mappings/image-jpg.tid @@ -0,0 +1,3 @@ +title: $:/config/EditorTypeMappings/image/jpg + +bitmap \ No newline at end of file diff --git a/core/config/editor-type-mappings/image-png.tid b/core/config/editor-type-mappings/image-png.tid new file mode 100644 index 000000000..4c4f613cd --- /dev/null +++ b/core/config/editor-type-mappings/image-png.tid @@ -0,0 +1,3 @@ +title: $:/config/EditorTypeMappings/image/png + +bitmap \ No newline at end of file diff --git a/core/config/editor-type-mappings/image-x-icon.tid b/core/config/editor-type-mappings/image-x-icon.tid new file mode 100644 index 000000000..d2b4d0d99 --- /dev/null +++ b/core/config/editor-type-mappings/image-x-icon.tid @@ -0,0 +1,3 @@ +title: $:/config/EditorTypeMappings/image/x-icon + +bitmap \ No newline at end of file diff --git a/core/config/editor-type-mappings/text-vnd-tiddlywiki.tid b/core/config/editor-type-mappings/text-vnd-tiddlywiki.tid new file mode 100644 index 000000000..fee2a2a62 --- /dev/null +++ b/core/config/editor-type-mappings/text-vnd-tiddlywiki.tid @@ -0,0 +1,3 @@ +title: $:/config/EditorTypeMappings/text/vnd.tiddlywiki + +text \ No newline at end of file diff --git a/core/modules/widgets/edit.js b/core/modules/widgets/edit.js index 26a0091d1..c5a7a4969 100644 --- a/core/modules/widgets/edit.js +++ b/core/modules/widgets/edit.js @@ -33,17 +33,8 @@ EditWidget.prototype.render = function(parent,nextSibling) { this.renderChildren(parent,nextSibling); }; -// Mappings from content type to editor type -// TODO: This information should be configurable/extensible -var editorTypeMappings = { - "text/vnd.tiddlywiki": "text", - "image/svg+xml": "text", - "image/jpg": "bitmap", - "image/jpeg": "bitmap", - "image/gif": "bitmap", - "image/png": "bitmap", - "image/x-icon": "bitmap" -}; +// Mappings from content type to editor type are stored in tiddlers with this prefix +var EDITOR_MAPPING_PREFIX = "$:/config/EditorTypeMappings/"; /* Compute the internal state of the widget @@ -65,7 +56,7 @@ EditWidget.prototype.execute = function() { } type = type || "text/vnd.tiddlywiki"; // Choose the appropriate edit widget - var editorType = editorTypeMappings[type] || "text"; + var editorType = this.wiki.getTiddlerText(EDITOR_MAPPING_PREFIX + type) || "text"; // Make the child widgets this.makeChildWidgets([{ type: "edit-" + editorType,