mirror of
https://github.com/codex-team/editor.js
synced 2024-06-20 06:35:48 +02:00
hideToolbar flag added (#162)
This commit is contained in:
parent
d2e755086a
commit
9e32f5a47d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -55,6 +55,7 @@
|
|||
codex.editor.start({
|
||||
textareaId : "codex_area",
|
||||
initialBlockPlugin : 'paragraph',
|
||||
hideToolbar: false,
|
||||
tools : {
|
||||
paragraph: {
|
||||
type: 'paragraph',
|
||||
|
|
|
@ -41,7 +41,15 @@ module.exports = (function (callbacks) {
|
|||
|
||||
callbacks.tabKeyPressed = function (event) {
|
||||
|
||||
if ( !editor.toolbar.opened ) {
|
||||
var blockIsEmpty = !editor.content.currentNode.textContent.trim();
|
||||
|
||||
if (!blockIsEmpty) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if ( !editor.toolbar.opened ) {
|
||||
|
||||
editor.toolbar.open();
|
||||
|
||||
|
@ -361,9 +369,12 @@ module.exports = (function (callbacks) {
|
|||
/** Hide plus buttons */
|
||||
editor.toolbar.hidePlusButton();
|
||||
|
||||
/** Mark current block */
|
||||
editor.content.markBlock();
|
||||
if (!inputIsEmpty) {
|
||||
|
||||
/** Mark current block */
|
||||
editor.content.markBlock();
|
||||
|
||||
}
|
||||
|
||||
if ( isInitialType && inputIsEmpty ) {
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ module.exports = (function (core) {
|
|||
|
||||
}
|
||||
|
||||
editor.hideToolbar = userSettings.hideToolbar;
|
||||
|
||||
editor.nodes.textarea = document.getElementById(userSettings.textareaId || editor.settings.textareaId);
|
||||
|
||||
if (typeof editor.nodes.textarea === undefined || editor.nodes.textarea === null) {
|
||||
|
|
|
@ -34,6 +34,12 @@ module.exports = (function (toolbar) {
|
|||
*/
|
||||
toolbar.open = function () {
|
||||
|
||||
if (editor.hideToolbar) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
editor.nodes.toolbar.classList.add('opened');
|
||||
this.opened = true;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "codex.editor",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.1",
|
||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue