node-red/packages/node_modules/@node-red/nodes/core/common/90-comment.html

64 lines
2.3 KiB
HTML
Raw Normal View History

2013-09-05 16:02:48 +02:00
<script type="text/html" data-template-name="comment">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
2019-10-29 12:45:57 +01:00
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
2014-11-13 18:21:12 +01:00
<div class="form-row node-text-editor-row">
<input type="hidden" id="node-input-info" autofocus="autofocus">
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-input-info-editor"></div>
</div>
2013-09-05 16:02:48 +02:00
</script>
<script type="text/javascript">
RED.nodes.registerType('comment',{
2019-07-09 21:26:26 +02:00
category: 'common',
2013-09-05 16:02:48 +02:00
color:"#ffffff",
defaults: {
name: {value:""},
info: {value:""}
2013-09-05 16:02:48 +02:00
},
inputs:0,
outputs:0,
icon: "comment.svg",
2013-09-05 16:02:48 +02:00
label: function() {
return this.name||this._("comment.comment");
2013-09-05 16:02:48 +02:00
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
info: function() {
return this.name?"# "+this.name+"\n\n---\n\n":"";
},
oneditprepare: function() {
2015-02-13 01:15:07 +01:00
var that = this;
this.editor = RED.editor.createEditor({
id: 'node-input-info-editor',
mode: 'ace/mode/markdown',
value: $("#node-input-info").val()
});
this.editor.focus();
},
oneditsave: function() {
2015-02-13 01:15:07 +01:00
$("#node-input-info").val(this.editor.getValue());
this.editor.destroy();
delete this.editor;
2016-01-04 17:53:32 +01:00
},
oneditcancel: function() {
this.editor.destroy();
delete this.editor;
},
2016-01-04 17:53:32 +01:00
oneditresize: function(size) {
var rows = $("#dialog-form>div:not(.node-text-editor-row)");
var height = $("#dialog-form").height();
for (var i=0; i<rows.length; i++) {
2016-01-04 17:53:32 +01:00
height -= $(rows[i]).outerHeight(true);
}
var editorRow = $("#dialog-form>div.node-text-editor-row");
height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
$(".node-text-editor").css("height",height+"px");
this.editor.resize();
2013-09-05 16:02:48 +02:00
}
});
</script>