Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cover restoring, versioning, sanitize and new initialization structure #105

Merged
merged 15 commits into from
Jan 10, 2017
Prev Previous commit
Next Next commit
code improved
  • Loading branch information
khaydarov committed Dec 23, 2016
commit c3d16cd8ea1f978fe369a7728be34a73a6688c5c
1 change: 1 addition & 0 deletions codex-editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
* Plus button
*/
.ce-toolbar__plus{
position: absolute;
background-image: url('fonts/codex_editor/icon-plus.svg');
background-position: center center;
background-repeat: no-repeat;
Expand Down
20 changes: 12 additions & 8 deletions codex-editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codex-editor.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions editor.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @author Codex Team
* @version 1.0.5
*/

var codex = (function(codex){

var init = function() {
Expand Down
9 changes: 4 additions & 5 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

</body>

<script src="./codex-editor.js?v=10"></script>
<link rel="stylesheet" href="./codex-editor.css?v=10">
<script src="./codex-editor.js?v=11"></script>
<link rel="stylesheet" href="./codex-editor.css?v=11">

<link rel="stylesheet" href="codex-editor.css">

Expand Down Expand Up @@ -57,7 +57,6 @@
settings: null,
render: paragraphTool.render,
save: paragraphTool.save,
displayInToolbox: false,
enableLineBreaks: false,
allowedToPaste: true
},
Expand All @@ -70,7 +69,6 @@
settings: null,
render: null,
save: pasteTool.save,
displayInToolbox: false,
enableLineBreaks: false,
callbacks: pasteTool.callbacks,
allowedToPaste: false
Expand All @@ -82,7 +80,8 @@
appendCallback: headerTool.appendCallback,
settings: headerTool.makeSettings(),
render: headerTool.render,
save: headerTool.save
save: headerTool.save,
displayInToolbox: true
},
code: {
type: 'code',
Expand Down
13 changes: 6 additions & 7 deletions modules/toolbar/toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ var toolbox = (function(toolbox) {
toolbox.leaf = function(){

var currentTool = codex.toolbar.current,
tool,
tools = Object.keys(codex.tools),
barButtons = codex.nodes.toolbarButtons,
nextToolIndex,
hiddenToolsAmount = 0,
toolToSelect;

/** Count toolbox hidden tools */
for( tool in codex.tools ) {
for( var tool in codex.tools ) {
if (!codex.tools[tool].displayInToolbox)
hiddenToolsAmount ++;
}
Expand All @@ -66,20 +65,20 @@ var toolbox = (function(toolbox) {

nextToolIndex = tools.indexOf(currentTool) + 1;

var toolIsLastInToolbox = nextToolIndex == tools.length - (hiddenToolsAmount - 1);
var toolIsLastInToolbox = nextToolIndex == tools.length - (hiddenToolsAmount - 2);

if ( toolIsLastInToolbox ) {

nextToolIndex = 0;

/** getting first displayed tool */
for( tool in codex.tools ) {
for( var tool in codex.tools ) {

nextToolIndex ++;

if (!codex.tools[tool].displayInToolbox){
if (codex.tools[tool].displayInToolbox){
break;
}

nextToolIndex ++;
}

}
Expand Down
2 changes: 1 addition & 1 deletion modules/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ var ui = (function(ui){

tool = codex.tools[name];

if (tool.displayInToolbox == false) {
if (!tool.displayInToolbox) {
continue;
}

Expand Down