mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-23 15:36:52 +00:00
different classes for text-editor and bitmap-editor
This commit is contained in:
parent
fc8396273e
commit
04b9e5ba4c
@ -54,10 +54,14 @@ EditBitmapWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
this.toolbarNode.className = "tc-editor-toolbar";
|
this.toolbarNode.className = "tc-editor-toolbar";
|
||||||
parent.insertBefore(this.toolbarNode,nextSibling);
|
parent.insertBefore(this.toolbarNode,nextSibling);
|
||||||
this.domNodes.push(this.toolbarNode);
|
this.domNodes.push(this.toolbarNode);
|
||||||
|
var classes = this.getAttribute("class","").split(" ");
|
||||||
|
if(classes.indexOf("tc-edit-bitmapeditor") === -1) {
|
||||||
|
classes.push("tc-edit-bitmapeditor");
|
||||||
|
}
|
||||||
// Create the on-screen canvas
|
// Create the on-screen canvas
|
||||||
this.canvasDomNode = $tw.utils.domMaker("canvas",{
|
this.canvasDomNode = $tw.utils.domMaker("canvas",{
|
||||||
document: this.document,
|
document: this.document,
|
||||||
"class":"tc-edit-bitmapeditor",
|
"class": classes.join(" "),
|
||||||
eventListeners: [{
|
eventListeners: [{
|
||||||
name: "touchstart", handlerObject: this, handlerMethod: "handleTouchStartEvent"
|
name: "touchstart", handlerObject: this, handlerMethod: "handleTouchStartEvent"
|
||||||
},{
|
},{
|
||||||
@ -90,6 +94,14 @@ EditBitmapWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EditBitmapWidget.prototype.assignDomNodeClasses = function() {
|
||||||
|
var classes = this.getAttribute("class","").split(" ");
|
||||||
|
if(classes.indexOf("tc-edit-bitmapeditor") === -1) {
|
||||||
|
classes.push("tc-edit-bitmapeditor");
|
||||||
|
}
|
||||||
|
this.canvasDomNode.className = classes.join(" ");
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Handle an edit bitmap operation message from the toolbar
|
Handle an edit bitmap operation message from the toolbar
|
||||||
*/
|
*/
|
||||||
@ -115,6 +127,10 @@ EditBitmapWidget.prototype.execute = function() {
|
|||||||
Just refresh the toolbar
|
Just refresh the toolbar
|
||||||
*/
|
*/
|
||||||
EditBitmapWidget.prototype.refresh = function(changedTiddlers) {
|
EditBitmapWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
|
var changedAttributes = this.computeAttributes();
|
||||||
|
if(changedAttributes["class"]) {
|
||||||
|
this.assignDomNodeClasses();
|
||||||
|
}
|
||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ title: $:/core/ui/EditTemplate/body/editor
|
|||||||
<$edit
|
<$edit
|
||||||
|
|
||||||
field="text"
|
field="text"
|
||||||
class=<<get.tc-edit-texteditor.class>>
|
class=<<get.tc-editor.class>>
|
||||||
placeholder={{$:/language/EditTemplate/Body/Placeholder}}
|
placeholder={{$:/language/EditTemplate/Body/Placeholder}}
|
||||||
tabindex={{$:/config/EditTabIndex}}
|
tabindex={{$:/config/EditTabIndex}}
|
||||||
focus={{{ [{$:/config/AutoFocus}match[text]then[true]] ~[[false]] }}}
|
focus={{{ [{$:/config/AutoFocus}match[text]then[true]] ~[[false]] }}}
|
||||||
|
@ -6,7 +6,7 @@ title: $:/core/ui/EditTemplate/body/default
|
|||||||
[{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualified-preview-state>] +[get[text]] :else[[no]]
|
[{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[<qualified-preview-state>] +[get[text]] :else[[no]]
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\function get.tc-edit-texteditor.class() tc-edit-texteditor tc-edit-texteditor-body [<get.edit-preview-state>match[yes]then<identifier>addprefix[tc-edit-texteditor-identified-]] +[join[ ]]
|
\function get.tc-editor.class() [{!!type}is[blank]then[tc-edit-texteditor tc-edit-texteditor-body]] [{!!type}is[blank]then<get.edit-preview-state>match[yes]then<identifier>addprefix[tc-edit-texteditor-identified-]] [{!!type}addprefix[$:/config/EditorTypeMappings/]get[text]!match[bitmap]then[tc-edit-texteditor tc-edit-texteditor-body]] [{!!type}addprefix[$:/config/EditorTypeMappings/]get[text]!match[bitmap]then<get.edit-preview-state>match[yes]then<identifier>addprefix[tc-edit-texteditor-identified-]] [{!!type}addprefix[$:/config/EditorTypeMappings/]get[text]match[bitmap]then[tc-edit-bitmapeditor tc-edit-bitmapeditor-body]] [{!!type}addprefix[$:/config/EditorTypeMappings/]get[text]match[bitmap]then<get.edit-preview-state>match[yes]then<identifier>addprefix[tc-edit-bitmapeditor-identified-]] +[join[ ]]
|
||||||
|
|
||||||
\function get.tc-tiddler-preview-preview.class() tc-tiddler-preview-preview [<identifier>addprefix[tc-tiddler-preview-preview-identified-]] +[join[ ]]
|
\function get.tc-tiddler-preview-preview.class() tc-tiddler-preview-preview [<identifier>addprefix[tc-tiddler-preview-preview-identified-]] +[join[ ]]
|
||||||
|
|
||||||
|
@ -1775,6 +1775,7 @@ html body.tc-body.tc-single-tiddler-window {
|
|||||||
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview-hidden canvas.tc-edit-bitmapeditor {
|
.tc-tiddler-frame .tc-tiddler-editor.tc-tiddler-preview-hidden canvas.tc-edit-bitmapeditor {
|
||||||
grid-area: editor;
|
grid-area: editor;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tc-edit-fields {
|
.tc-edit-fields {
|
||||||
|
@ -183,14 +183,16 @@ code-body: yes
|
|||||||
|
|
||||||
.tc-tiddler-frame iframe[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor,
|
.tc-tiddler-frame iframe[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor,
|
||||||
.tc-tiddler-frame textarea[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor,
|
.tc-tiddler-frame textarea[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor,
|
||||||
.tc-tiddler-frame div[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor {
|
.tc-tiddler-frame div[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor,
|
||||||
|
.tc-tiddler-frame canvas[class*="tc-edit-bitmapeditor-identified-"].tc-edit-bitmapeditor {
|
||||||
width: calc(100% - <<get.theme.metric previewsliderwidth>>);
|
width: calc(100% - <<get.theme.metric previewsliderwidth>>);
|
||||||
min-width: 0px;
|
min-width: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tc-tiddler-frame iframe[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor + .tc-tiddler-preview-preview,
|
.tc-tiddler-frame iframe[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor + .tc-tiddler-preview-preview,
|
||||||
.tc-tiddler-frame textarea[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor + .tc-tiddler-preview-preview,
|
.tc-tiddler-frame textarea[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor + .tc-tiddler-preview-preview,
|
||||||
.tc-tiddler-frame div[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor + .tc-tiddler-preview-preview {
|
.tc-tiddler-frame div[class*="tc-edit-texteditor-identified-"].tc-edit-texteditor + .tc-tiddler-preview-preview,
|
||||||
|
.tc-tiddler-frame canvas[class*="tc-edit-bitmapeditor-identified-"].tc-edit-bitmapeditor + .tc-tiddler-preview-preview {
|
||||||
min-width: 0px;
|
min-width: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user