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

68 lines
2.5 KiB
HTML
Raw Normal View History

2013-09-05 16:02:48 +02:00
<script type="text/x-red" data-template-name="comment">
<div class="form-row">
2015-05-28 00:07:31 +02:00
<label for="node-input-name"><i class="fa fa-comment"></i> <span data-i18n="comment.label.title"></span></label>
<input type="text" id="node-input-name">
</div>
2014-11-13 18:21:12 +01:00
<div class="form-row" style="margin-bottom: 0px;">
2015-05-28 00:07:31 +02:00
<label for="node-input-info" style="width: 100% !important;"><i class="fa fa-comments"></i> <span data-i18n="comment.label.body"></span></label>
2013-10-09 23:12:06 +02:00
<input type="hidden" id="node-input-info" autofocus="autofocus">
2014-11-13 18:21:12 +01:00
</div>
<div class="form-row node-text-editor-row">
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-input-info-editor"></div>
</div>
2015-05-28 00:07:31 +02:00
<div class="form-tips" data-i18n="[html]comment.tip"></div>
2013-09-05 16:02:48 +02:00
</script>
<script type="text/javascript">
RED.nodes.registerType('comment',{
category: 'function',
color:"#ffffff",
defaults: {
name: {value:""},
info: {value:""}
2013-09-05 16:02:48 +02:00
},
inputs:0,
outputs:0,
icon: "comment.png",
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() {
2015-07-14 00:21:03 +02:00
return (this.name?"# "+this.name+"\n":"")+(this.info||"");
},
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.size(); 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>