|
From: <tob...@us...> - 2014-07-22 00:33:22
|
Revision: 8584
http://sourceforge.net/p/bigdata/code/8584
Author: tobycraig
Date: 2014-07-22 00:33:17 +0000 (Tue, 22 Jul 2014)
Log Message:
-----------
Fixed issue with placeholder text for query/update textboxes
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 00:02:38 UTC (rev 8583)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-war/src/html/js/workbench.js 2014-07-22 00:33:17 UTC (rev 8584)
@@ -7,8 +7,7 @@
// query/update editors
var EDITORS = {}, ERROR_LINE_MARKERS = {}, ERROR_CHARACTER_MARKERS = {};
-var CODEMIRROR_DEFAULTS = {};
-CodeMirror.defaults = {
+var CODEMIRROR_DEFAULTS = {
lineNumbers: true,
mode: 'sparql',
extraKeys: {'Ctrl-,': moveTabLeft, 'Ctrl-.': moveTabRight}
@@ -601,7 +600,7 @@
}
function createUpdateEditor() {
- EDITORS.update = CodeMirror.fromTextArea($('#update-box')[0], CODEMIRROR_DEFAULTS);
+ EDITORS.update = CodeMirror.fromTextArea($('#update-box')[0], copyObject(CODEMIRROR_DEFAULTS));
EDITORS.update.on('change', function() {
if(ERROR_LINE_MARKERS.update) {
ERROR_LINE_MARKERS.update.clear();
@@ -732,7 +731,7 @@
}
function createQueryEditor() {
- EDITORS.query = CodeMirror.fromTextArea($('#query-box')[0], CODEMIRROR_DEFAULTS);
+ EDITORS.query = CodeMirror.fromTextArea($('#query-box')[0], copyObject(CODEMIRROR_DEFAULTS));
EDITORS.query.on('change', function() {
if(ERROR_LINE_MARKERS.query) {
ERROR_LINE_MARKERS.query.clear();
@@ -1608,7 +1607,19 @@
return $('<div/>').text(text).html();
}
+function copyObject(src) {
+ // this returns a new object with the same keys & values as the input one.
+ // It is used to get around CodeMirror updating the default config object
+ // passed to it with the values used, which are then applied to later uses
+ // of the default config object.
+ dest = {};
+ for(var key in src) {
+ dest[key] = src[key];
+ }
+ return dest;
+}
+
/* Startup functions */
function setupHandlers() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|