mirror of
https://github.com/codex-team/editor.js
synced 2024-06-27 09:50:05 +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({
|
codex.editor.start({
|
||||||
textareaId : "codex_area",
|
textareaId : "codex_area",
|
||||||
initialBlockPlugin : 'paragraph',
|
initialBlockPlugin : 'paragraph',
|
||||||
|
hideToolbar: false,
|
||||||
tools : {
|
tools : {
|
||||||
paragraph: {
|
paragraph: {
|
||||||
type: 'paragraph',
|
type: 'paragraph',
|
||||||
|
|
|
@ -41,7 +41,15 @@ module.exports = (function (callbacks) {
|
||||||
|
|
||||||
callbacks.tabKeyPressed = function (event) {
|
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();
|
editor.toolbar.open();
|
||||||
|
|
||||||
|
@ -361,9 +369,12 @@ module.exports = (function (callbacks) {
|
||||||
/** Hide plus buttons */
|
/** Hide plus buttons */
|
||||||
editor.toolbar.hidePlusButton();
|
editor.toolbar.hidePlusButton();
|
||||||
|
|
||||||
/** Mark current block */
|
if (!inputIsEmpty) {
|
||||||
editor.content.markBlock();
|
|
||||||
|
|
||||||
|
/** Mark current block */
|
||||||
|
editor.content.markBlock();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if ( isInitialType && inputIsEmpty ) {
|
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);
|
editor.nodes.textarea = document.getElementById(userSettings.textareaId || editor.settings.textareaId);
|
||||||
|
|
||||||
if (typeof editor.nodes.textarea === undefined || editor.nodes.textarea === null) {
|
if (typeof editor.nodes.textarea === undefined || editor.nodes.textarea === null) {
|
||||||
|
|
|
@ -34,6 +34,12 @@ module.exports = (function (toolbar) {
|
||||||
*/
|
*/
|
||||||
toolbar.open = function () {
|
toolbar.open = function () {
|
||||||
|
|
||||||
|
if (editor.hideToolbar) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
editor.nodes.toolbar.classList.add('opened');
|
editor.nodes.toolbar.classList.add('opened');
|
||||||
this.opened = true;
|
this.opened = true;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "codex.editor",
|
"name": "codex.editor",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue