mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add markdown toolbar to flow description editor
This commit is contained in:
parent
7a8545273c
commit
fc8c4063f2
@ -199,6 +199,9 @@ RED.editor.types._markdown = (function() {
|
||||
}
|
||||
} else {
|
||||
editor.session.replace(editor.selection.getRange(), (style.before||"")+current+(style.after||""));
|
||||
if (current === "") {
|
||||
editor.gotoLine(range.start.row+1,range.start.column+(style.before||"").length,false);
|
||||
}
|
||||
}
|
||||
editor.focus();
|
||||
});
|
||||
|
@ -150,13 +150,14 @@ RED.workspaces = (function() {
|
||||
|
||||
$('<div class="form-row">'+
|
||||
'<label for="node-input-disabled-btn" data-i18n="editor:workspace.status"></label>'+
|
||||
'<button id="node-input-disabled-btn" class="editor-button"><i class="fa fa-toggle-on"></i> <span id="node-input-disabled-label"></span></button> '+
|
||||
'<button type="button" id="node-input-disabled-btn" class="editor-button"><i class="fa fa-toggle-on"></i> <span id="node-input-disabled-label"></span></button> '+
|
||||
'<input type="checkbox" id="node-input-disabled" style="display: none;"/>'+
|
||||
'</div>').appendTo(dialogForm);
|
||||
|
||||
$('<div class="form-row node-text-editor-row">'+
|
||||
var row = $('<div class="form-row node-text-editor-row">'+
|
||||
'<label for="node-input-info" data-i18n="editor:workspace.info" style="width:300px;"></label>'+
|
||||
'<div style="height:250px;" class="node-text-editor" id="node-input-info"></div>'+
|
||||
'<div class="node-text-editor-toolbar"></div>'+
|
||||
'<div style="min-height:250px;" class="node-text-editor" id="node-input-info"></div>'+
|
||||
'</div>').appendTo(dialogForm);
|
||||
tabflowEditor = RED.editor.createEditor({
|
||||
id: 'node-input-info',
|
||||
@ -164,7 +165,26 @@ RED.workspaces = (function() {
|
||||
value: ""
|
||||
});
|
||||
|
||||
$('<div class="form-tips" data-i18n="editor:workspace.tip"></div>').appendTo(dialogForm);
|
||||
var toolbar = RED.editor.types._markdown.buildToolbar(row.find(".node-text-editor-toolbar"),tabflowEditor);
|
||||
|
||||
$('<button id="node-info-input-info-expand" class="editor-button" style="float: right;"><i class="fa fa-expand"></i></button>').appendTo(toolbar);
|
||||
|
||||
$('#node-info-input-info-expand').click(function(e) {
|
||||
e.preventDefault();
|
||||
var value = tabflowEditor.getValue();
|
||||
RED.editor.editMarkdown({
|
||||
value: value,
|
||||
width: "Infinity",
|
||||
cursor: tabflowEditor.getCursorPosition(),
|
||||
complete: function(v,cursor) {
|
||||
tabflowEditor.setValue(v, -1);
|
||||
tabflowEditor.gotoLine(cursor.row+1,cursor.column,false);
|
||||
setTimeout(function() {
|
||||
tabflowEditor.focus();
|
||||
},300);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
dialogForm.find('#node-input-disabled-btn').on("click",function(e) {
|
||||
var i = $(this).find("i");
|
||||
|
Loading…
Reference in New Issue
Block a user