mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-07 10:07:04 +02:00
Added ability to prevent from rendering any desired toolbar button from yaml declaration
This commit is contained in:
@@ -148,32 +148,36 @@ export class Toolbar {
|
||||
this.ui.navigation.find('.grav-editor-actions').empty().append('<ul />');
|
||||
Buttons.navigation.forEach((button) => {
|
||||
Object.keys(button).forEach((key) => {
|
||||
let obj = button[key];
|
||||
let element = $(`<li class="grav-editor-button-${key}"><a class="hint--top" data-hint="${obj.title}" title="${obj.title}">${obj.label}</a></li>`);
|
||||
this.ui.navigation.find('.grav-editor-actions ul').append(element);
|
||||
if (!~this.codemirror.options.ignore.indexOf(key)) {
|
||||
let obj = button[key];
|
||||
let element = $(`<li class="grav-editor-button-${key}"><a class="hint--top" data-hint="${obj.title}" title="${obj.title}">${obj.label}</a></li>`);
|
||||
this.ui.navigation.find('.grav-editor-actions ul').append(element);
|
||||
|
||||
obj.action && obj.action.call(obj.action, {
|
||||
codemirror: this.codemirror,
|
||||
button: element,
|
||||
textarea: this.editor,
|
||||
ui: this.ui
|
||||
});
|
||||
obj.action && obj.action.call(obj.action, {
|
||||
codemirror: this.codemirror,
|
||||
button: element,
|
||||
textarea: this.editor,
|
||||
ui: this.ui
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.ui.navigation.find('.grav-editor-modes').empty().append('<ul />');
|
||||
Buttons.states.forEach((button) => {
|
||||
Object.keys(button).forEach((key) => {
|
||||
let obj = button[key];
|
||||
let element = $(`<li class="grav-editor-button-${key}"><a class="hint--top" data-hint="${obj.title}" title="${obj.title}">${obj.label}</a></li>`);
|
||||
this.ui.navigation.find('.grav-editor-modes ul').append(element);
|
||||
if (!~this.codemirror.options.ignore.indexOf(key)) {
|
||||
let obj = button[key];
|
||||
let element = $(`<li class="grav-editor-button-${key}"><a class="hint--top" data-hint="${obj.title}" title="${obj.title}">${obj.label}</a></li>`);
|
||||
this.ui.navigation.find('.grav-editor-modes ul').append(element);
|
||||
|
||||
obj.action && obj.action.call(obj.action, {
|
||||
codemirror: this.codemirror,
|
||||
button: element,
|
||||
textarea: this.editor,
|
||||
ui: this.ui
|
||||
});
|
||||
obj.action && obj.action.call(obj.action, {
|
||||
codemirror: this.codemirror,
|
||||
button: element,
|
||||
textarea: this.editor,
|
||||
ui: this.ui
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
2
themes/grav/css-compiled/template.css
vendored
2
themes/grav/css-compiled/template.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
22
themes/grav/js/admin.min.js
vendored
22
themes/grav/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -36,10 +36,10 @@
|
||||
@include flex-direction(row);
|
||||
|
||||
.grav-editor-actions {
|
||||
@include flex(80% 0 0);
|
||||
@include flex(1);
|
||||
}
|
||||
.grav-editor-modes {
|
||||
@include flex(1);
|
||||
@include flex(150px 0 0);
|
||||
ul {
|
||||
float: right;
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ form {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
li {
|
||||
> li {
|
||||
cursor: move;
|
||||
padding: 1rem;
|
||||
border-radius: $form-border-radius;
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
{% set value = (value is null ? field.default : value) %}
|
||||
{% set codemirrorOptions = {'mode': 'gfm'}|merge(field.codemirror|default({})) %}
|
||||
{% set codemirrorOptions = {'mode': 'gfm', 'ignore': ['code', 'preview']}|merge(field.codemirror|default({})) %}
|
||||
|
||||
{# backward compatibility #}
|
||||
{% if field.showPreview %}
|
||||
{% set codemirrorOptions = codemirrorOptions|merge({'ignore': []}) %}
|
||||
{% endif %}
|
||||
{# end backward compatibility #}
|
||||
|
||||
{% block label %}
|
||||
{% if field.label %}
|
||||
@@ -16,7 +22,6 @@
|
||||
data-grav-editor-mode="editor"
|
||||
name="{{ (scope ~ field.name)|fieldName }}"
|
||||
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
|
||||
{% if field.showPreview %}data-grav-preview-enabled="true"{% endif %}
|
||||
data-grav-urlpreview="{{ base_url }}/media/{{ admin.route|trim('/') }}.json">{{ value|join("\n")|e('html') }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user