mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Take editor configuration from configuration tiddlers
This should enable @buggyj to add an html editor by including a configuration tiddler in the plugin.
This commit is contained in:
parent
9522050aa7
commit
70a7321edd
3
core/config/editor-type-mappings/image-gif.tid
Normal file
3
core/config/editor-type-mappings/image-gif.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/image/gif
|
||||
|
||||
bitmap
|
3
core/config/editor-type-mappings/image-jpeg.tid
Normal file
3
core/config/editor-type-mappings/image-jpeg.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/image/jpeg
|
||||
|
||||
bitmap
|
3
core/config/editor-type-mappings/image-jpg.tid
Normal file
3
core/config/editor-type-mappings/image-jpg.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/image/jpg
|
||||
|
||||
bitmap
|
3
core/config/editor-type-mappings/image-png.tid
Normal file
3
core/config/editor-type-mappings/image-png.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/image/png
|
||||
|
||||
bitmap
|
3
core/config/editor-type-mappings/image-x-icon.tid
Normal file
3
core/config/editor-type-mappings/image-x-icon.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/image/x-icon
|
||||
|
||||
bitmap
|
3
core/config/editor-type-mappings/text-vnd-tiddlywiki.tid
Normal file
3
core/config/editor-type-mappings/text-vnd-tiddlywiki.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/config/EditorTypeMappings/text/vnd.tiddlywiki
|
||||
|
||||
text
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user