Added support for search (Ctrl+F) in the code editor Ace

This commit is contained in:
josdejong 2013-10-17 11:07:46 +02:00
parent 7fa3e0cc94
commit 122d8b4e87
12 changed files with 53 additions and 48 deletions

View File

@ -5,6 +5,7 @@ http://jsoneditoronline.org
## not yet released, version 2.3.3 ## not yet released, version 2.3.3
- Added support for search (Ctrl+F) in the code editor Ace.
- Fixed a positioning issue of the action menu when in bootstrap modal. - Fixed a positioning issue of the action menu when in bootstrap modal.
(thanks tsash). (thanks tsash).

View File

@ -248,7 +248,8 @@ task('webapp', ['build', 'minify'], function () {
libSrc + 'ace/ace.js', libSrc + 'ace/ace.js',
libSrc + 'ace/mode-json.js', libSrc + 'ace/mode-json.js',
libSrc + 'ace/theme-textmate.js', libSrc + 'ace/theme-textmate.js',
libSrc + 'ace/theme-jsoneditor.js' libSrc + 'ace/theme-jsoneditor.js',
libSrc + 'ace/ext-searchbox.js'
], ],
dest: webAppAce + 'ace-min.js', dest: webAppAce + 'ace-min.js',
separator: '\n' separator: '\n'

View File

@ -1,6 +1,6 @@
{ {
"name": "jsoneditor", "name": "jsoneditor",
"version": "2.3.2", "version": "2.3.3",
"description": "A web-based tool to view, edit and format JSON", "description": "A web-based tool to view, edit and format JSON",
"tags": [ "tags": [
"json", "json",

2
jsoneditor-min.css vendored

File diff suppressed because one or more lines are too long

6
jsoneditor-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -80,7 +80,7 @@
border-radius: 2px; border-radius: 2px;
} }
.jsoneditor button { .jsoneditor div.tree button {
width: 24px; width: 24px;
height: 24px; height: 24px;
padding: 0; padding: 0;
@ -90,29 +90,29 @@
background: transparent url('img/jsoneditor-icons.png'); background: transparent url('img/jsoneditor-icons.png');
} }
.jsoneditor button.collapsed { .jsoneditor div.tree button.collapsed {
background-position: 0 -48px; background-position: 0 -48px;
} }
.jsoneditor button.expanded { .jsoneditor div.tree button.expanded {
background-position: 0 -72px; background-position: 0 -72px;
} }
.jsoneditor button.contextmenu { .jsoneditor div.tree button.contextmenu {
background-position: -48px -72px; background-position: -48px -72px;
} }
.jsoneditor button.contextmenu:hover, .jsoneditor div.tree button.contextmenu:hover,
.jsoneditor button.contextmenu:focus, .jsoneditor div.tree button.contextmenu:focus,
.jsoneditor button.contextmenu.selected { .jsoneditor div.tree button.contextmenu.selected {
background-position: -48px -48px; background-position: -48px -48px;
} }
.jsoneditor div.content *:focus { .jsoneditor div.tree *:focus {
outline: none; outline: none;
} }
.jsoneditor div.content button:focus { .jsoneditor div.tree button:focus {
/* TODO: nice outline for buttons with focus /* TODO: nice outline for buttons with focus
outline: #97B0F8 solid 2px; outline: #97B0F8 solid 2px;
box-shadow: 0 0 8px #97B0F8; box-shadow: 0 0 8px #97B0F8;
@ -121,7 +121,7 @@
outline: #e5e5e5 solid 1px; outline: #e5e5e5 solid 1px;
} }
.jsoneditor button.invisible { .jsoneditor div.tree button.invisible {
visibility: hidden; visibility: hidden;
background: none; background: none;
} }
@ -139,7 +139,8 @@ div.jsoneditor {
padding: 0; padding: 0;
} }
.jsoneditor table.content {
.jsoneditor div.tree table.tree {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
width: 100%; width: 100%;
@ -159,14 +160,14 @@ div.jsoneditor {
overflow: hidden; overflow: hidden;
} }
.jsoneditor div.content { .jsoneditor div.tree {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative; position: relative;
overflow: auto; overflow: auto;
} }
.jsoneditor textarea.content { .jsoneditor textarea.text {
width: 100%; width: 100%;
height: 100%; height: 100%;
margin: 0; margin: 0;
@ -184,13 +185,13 @@ div.jsoneditor {
background-color: #FFFFAB; background-color: #FFFFAB;
} }
.jsoneditor button.dragarea { .jsoneditor div.tree button.dragarea {
background: url('img/jsoneditor-icons.png') -72px -72px; background: url('img/jsoneditor-icons.png') -72px -72px;
cursor: move; cursor: move;
} }
.jsoneditor button.dragarea:hover, .jsoneditor div.tree button.dragarea:hover,
.jsoneditor button.dragarea:focus { .jsoneditor div.tree button.dragarea:focus {
background-position: -72px -48px; background-position: -72px -48px;
} }
@ -223,7 +224,7 @@ div.jsoneditor {
/* ContextMenu - main menu */ /* ContextMenu - main menu */
.jsoneditor-contextmenu { .jsoneditor-contextmenu {
position: absolute; position: fixed;
z-index: 99999; z-index: 99999;
} }

View File

@ -27,8 +27,8 @@
* Copyright (c) 2011-2013 Jos de Jong, http://jsoneditoronline.org * Copyright (c) 2011-2013 Jos de Jong, http://jsoneditoronline.org
* *
* @author Jos de Jong, <wjosdejong@gmail.com> * @author Jos de Jong, <wjosdejong@gmail.com>
* @version 2.3.2 * @version 2.3.3
* @date 2013-09-26 * @date 2013-10-17
*/ */
(function () { (function () {
@ -953,11 +953,11 @@ TreeEditor.prototype._createTable = function () {
this.contentOuter = contentOuter; this.contentOuter = contentOuter;
this.content = document.createElement('div'); this.content = document.createElement('div');
this.content.className = 'content'; this.content.className = 'tree';
contentOuter.appendChild(this.content); contentOuter.appendChild(this.content);
this.table = document.createElement('table'); this.table = document.createElement('table');
this.table.className = 'content'; this.table.className = 'tree';
this.content.appendChild(this.table); this.content.appendChild(this.table);
// IE8 does not handle overflow='auto' correctly. // IE8 does not handle overflow='auto' correctly.
@ -1174,7 +1174,7 @@ TextEditor.prototype._create = function (container, options, json) {
else { else {
// load a plain text textarea // load a plain text textarea
var textarea = document.createElement('textarea'); var textarea = document.createElement('textarea');
textarea.className = 'content'; textarea.className = 'text';
textarea.spellcheck = false; textarea.spellcheck = false;
this.content.appendChild(textarea); this.content.appendChild(textarea);
this.textarea = textarea; this.textarea = textarea;

View File

@ -80,7 +80,7 @@
border-radius: 2px; border-radius: 2px;
} }
.jsoneditor button { .jsoneditor div.tree button {
width: 24px; width: 24px;
height: 24px; height: 24px;
padding: 0; padding: 0;
@ -90,29 +90,29 @@
background: transparent url('img/jsoneditor-icons.png'); background: transparent url('img/jsoneditor-icons.png');
} }
.jsoneditor button.collapsed { .jsoneditor div.tree button.collapsed {
background-position: 0 -48px; background-position: 0 -48px;
} }
.jsoneditor button.expanded { .jsoneditor div.tree button.expanded {
background-position: 0 -72px; background-position: 0 -72px;
} }
.jsoneditor button.contextmenu { .jsoneditor div.tree button.contextmenu {
background-position: -48px -72px; background-position: -48px -72px;
} }
.jsoneditor button.contextmenu:hover, .jsoneditor div.tree button.contextmenu:hover,
.jsoneditor button.contextmenu:focus, .jsoneditor div.tree button.contextmenu:focus,
.jsoneditor button.contextmenu.selected { .jsoneditor div.tree button.contextmenu.selected {
background-position: -48px -48px; background-position: -48px -48px;
} }
.jsoneditor div.content *:focus { .jsoneditor div.tree *:focus {
outline: none; outline: none;
} }
.jsoneditor div.content button:focus { .jsoneditor div.tree button:focus {
/* TODO: nice outline for buttons with focus /* TODO: nice outline for buttons with focus
outline: #97B0F8 solid 2px; outline: #97B0F8 solid 2px;
box-shadow: 0 0 8px #97B0F8; box-shadow: 0 0 8px #97B0F8;
@ -121,7 +121,7 @@
outline: #e5e5e5 solid 1px; outline: #e5e5e5 solid 1px;
} }
.jsoneditor button.invisible { .jsoneditor div.tree button.invisible {
visibility: hidden; visibility: hidden;
background: none; background: none;
} }
@ -139,7 +139,8 @@ div.jsoneditor {
padding: 0; padding: 0;
} }
.jsoneditor table.content {
.jsoneditor div.tree table.tree {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
width: 100%; width: 100%;
@ -159,14 +160,14 @@ div.jsoneditor {
overflow: hidden; overflow: hidden;
} }
.jsoneditor div.content { .jsoneditor div.tree {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: relative; position: relative;
overflow: auto; overflow: auto;
} }
.jsoneditor textarea.content { .jsoneditor textarea.text {
width: 100%; width: 100%;
height: 100%; height: 100%;
margin: 0; margin: 0;
@ -184,13 +185,13 @@ div.jsoneditor {
background-color: #FFFFAB; background-color: #FFFFAB;
} }
.jsoneditor button.dragarea { .jsoneditor div.tree button.dragarea {
background: url('img/jsoneditor-icons.png') -72px -72px; background: url('img/jsoneditor-icons.png') -72px -72px;
cursor: move; cursor: move;
} }
.jsoneditor button.dragarea:hover, .jsoneditor div.tree button.dragarea:hover,
.jsoneditor button.dragarea:focus { .jsoneditor div.tree button.dragarea:focus {
background-position: -72px -48px; background-position: -72px -48px;
} }

View File

@ -160,7 +160,7 @@ TextEditor.prototype._create = function (container, options, json) {
else { else {
// load a plain text textarea // load a plain text textarea
var textarea = document.createElement('textarea'); var textarea = document.createElement('textarea');
textarea.className = 'content'; textarea.className = 'text';
textarea.spellcheck = false; textarea.spellcheck = false;
this.content.appendChild(textarea); this.content.appendChild(textarea);
this.textarea = textarea; this.textarea = textarea;

View File

@ -712,11 +712,11 @@ TreeEditor.prototype._createTable = function () {
this.contentOuter = contentOuter; this.contentOuter = contentOuter;
this.content = document.createElement('div'); this.content = document.createElement('div');
this.content.className = 'content'; this.content.className = 'tree';
contentOuter.appendChild(this.content); contentOuter.appendChild(this.content);
this.table = document.createElement('table'); this.table = document.createElement('table');
this.table.className = 'content'; this.table.className = 'tree';
this.content.appendChild(this.table); this.content.appendChild(this.table);
// IE8 does not handle overflow='auto' correctly. // IE8 does not handle overflow='auto' correctly.

1
lib/ace/ext-searchbox.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "jsoneditor", "name": "jsoneditor",
"version": "2.3.2", "version": "2.3.3",
"main": "jsoneditor.js", "main": "jsoneditor.js",
"description": "A web-based tool to view, edit and format JSON", "description": "A web-based tool to view, edit and format JSON",
"tags": [ "tags": [