mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-09-24 16:40:55 -06:00
Add label inside toolbar if option is present
This commit is contained in:
parent
77038e4883
commit
7f07aa39ff
@ -166,6 +166,13 @@ function createToolbarButton(options, enableTooltips, shortcuts) {
|
|||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createLabel(label) {
|
||||||
|
var el = document.createElement('label');
|
||||||
|
el.className = "editor-label";
|
||||||
|
el.innerHTML = label;
|
||||||
|
return el;
|
||||||
|
}
|
||||||
|
|
||||||
function createSep() {
|
function createSep() {
|
||||||
var el = document.createElement('i');
|
var el = document.createElement('i');
|
||||||
el.className = 'separator';
|
el.className = 'separator';
|
||||||
@ -1788,6 +1795,7 @@ EasyMDE.prototype.createSideBySide = function () {
|
|||||||
|
|
||||||
EasyMDE.prototype.createToolbar = function (items) {
|
EasyMDE.prototype.createToolbar = function (items) {
|
||||||
items = items || this.options.toolbar;
|
items = items || this.options.toolbar;
|
||||||
|
label = this.options.label;
|
||||||
|
|
||||||
if (!items || items.length === 0) {
|
if (!items || items.length === 0) {
|
||||||
return;
|
return;
|
||||||
@ -1864,6 +1872,18 @@ EasyMDE.prototype.createToolbar = function (items) {
|
|||||||
})(items[i]);
|
})(items[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (label) {
|
||||||
|
var labelEl = document.createElement("label");
|
||||||
|
labelEl.className = "editor-label";
|
||||||
|
labelEl.innerHTML = label;
|
||||||
|
|
||||||
|
var labelBar = document.createElement("div");
|
||||||
|
labelBar.className = "editor-toolbar-label";
|
||||||
|
labelBar.appendChild(labelEl);
|
||||||
|
labelBar.appendChild(bar);
|
||||||
|
bar = labelBar;
|
||||||
|
}
|
||||||
|
|
||||||
self.toolbarElements = toolbarData;
|
self.toolbarElements = toolbarData;
|
||||||
|
|
||||||
var cm = this.codemirror;
|
var cm = this.codemirror;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user