2013-09-05 16:02:48 +02:00
|
|
|
|
2020-01-15 03:40:48 +01:00
|
|
|
<script type="text/html" data-template-name="comment">
|
2014-06-08 23:13:12 +02:00
|
|
|
<div class="form-row">
|
2018-12-10 16:23:02 +01:00
|
|
|
<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">
|
2014-06-08 23:13:12 +02:00
|
|
|
</div>
|
2014-11-13 18:21:12 +01:00
|
|
|
<div class="form-row node-text-editor-row">
|
2018-12-10 16:23:02 +01:00
|
|
|
<input type="hidden" id="node-input-info" autofocus="autofocus">
|
2016-05-06 18:19:32 +02:00
|
|
|
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-input-info-editor"></div>
|
2013-09-19 12:07:57 +02:00
|
|
|
</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: {
|
2013-09-19 12:07:57 +02:00
|
|
|
name: {value:""},
|
|
|
|
info: {value:""}
|
2013-09-05 16:02:48 +02:00
|
|
|
},
|
|
|
|
inputs:0,
|
|
|
|
outputs:0,
|
2019-06-21 13:36:20 +02:00
|
|
|
icon: "comment.svg",
|
2013-09-05 16:02:48 +02:00
|
|
|
label: function() {
|
2018-03-30 15:31:59 +02:00
|
|
|
return this.name||this._("comment.comment");
|
2013-09-05 16:02:48 +02:00
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
2013-09-19 12:07:57 +02:00
|
|
|
},
|
2015-01-29 16:57:05 +01:00
|
|
|
info: function() {
|
2018-12-10 16:23:02 +01:00
|
|
|
return this.name?"# "+this.name+"\n\n---\n\n":"";
|
2015-01-29 16:57:05 +01:00
|
|
|
},
|
2013-09-19 12:07:57 +02:00
|
|
|
oneditprepare: function() {
|
2015-02-13 01:15:07 +01:00
|
|
|
var that = this;
|
2015-02-26 22:29:56 +01:00
|
|
|
this.editor = RED.editor.createEditor({
|
|
|
|
id: 'node-input-info-editor',
|
2015-05-07 22:12:46 +02:00
|
|
|
mode: 'ace/mode/markdown',
|
|
|
|
value: $("#node-input-info").val()
|
2015-02-26 22:29:56 +01:00
|
|
|
});
|
|
|
|
this.editor.focus();
|
2013-09-19 12:07:57 +02:00
|
|
|
},
|
|
|
|
oneditsave: function() {
|
2015-02-13 01:15:07 +01:00
|
|
|
$("#node-input-info").val(this.editor.getValue());
|
2017-06-24 13:15:03 +02:00
|
|
|
this.editor.destroy();
|
2013-09-19 12:07:57 +02:00
|
|
|
delete this.editor;
|
2016-01-04 17:53:32 +01:00
|
|
|
},
|
2017-04-21 10:03:41 +02:00
|
|
|
oneditcancel: function() {
|
2017-06-24 13:15:03 +02:00
|
|
|
this.editor.destroy();
|
2017-04-21 10:03:41 +02:00
|
|
|
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();
|
2019-04-29 12:50:15 +02:00
|
|
|
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>
|