diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index a33320d6..1bb21189 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -27,7 +27,7 @@ mindplot.Designer = new Class({ // Dispatcher manager ... var commandContext = new mindplot.CommandContext(this); - if (options.collab == 'standalone') { + if (!$defined(options.collab) || options.collab == 'standalone') { this._actionDispatcher = new mindplot.StandaloneActionDispatcher(commandContext); } else { this._actionDispatcher = new mindplot.BrixActionDispatcher(commandContext); diff --git a/wise-editor/src/main/webapp/html/container.html b/wise-editor/src/main/webapp/html/container.html index 2263761a..b2dd68e0 100644 --- a/wise-editor/src/main/webapp/html/container.html +++ b/wise-editor/src/main/webapp/html/container.html @@ -14,10 +14,8 @@

Embedded editor sample

-

- -
- +
+
diff --git a/wise-editor/src/main/webapp/html/container.json b/wise-editor/src/main/webapp/html/container.json new file mode 100644 index 00000000..6ea27b64 --- /dev/null +++ b/wise-editor/src/main/webapp/html/container.json @@ -0,0 +1,9 @@ +{ + "readOnly":"false", + "zoom":0.85, + "saveOnLoad":false, + "size":{ + "width":800, + "height":600 + } +} \ No newline at end of file diff --git a/wise-editor/src/main/webapp/html/editor.html b/wise-editor/src/main/webapp/html/editor.html index 97068713..8f82c202 100644 --- a/wise-editor/src/main/webapp/html/editor.html +++ b/wise-editor/src/main/webapp/html/editor.html @@ -20,10 +20,9 @@ diff --git a/wise-editor/src/main/webapp/index.html b/wise-editor/src/main/webapp/index.html index 7e1907b5..7cdfa41e 100644 --- a/wise-editor/src/main/webapp/index.html +++ b/wise-editor/src/main/webapp/index.html @@ -1,6 +1,13 @@ - + + + + + Embedding the mindmap in a page + Full page + Read Only version + diff --git a/wise-editor/src/main/webapp/js/editor.js b/wise-editor/src/main/webapp/js/editor.js index 6d2d2cb0..bd80e2f6 100644 --- a/wise-editor/src/main/webapp/js/editor.js +++ b/wise-editor/src/main/webapp/js/editor.js @@ -18,30 +18,20 @@ var designer = null; -function buildDesigner(viewMode, containerSize) { +function buildDesigner(options) { var container = $('mindplot'); + container.setStyles(options.size); - // Set workspace size ... - if (!containerSize) { - containerSize = { - // Set workspace screen size as default. In this way, resize issues are solved. - height: parseInt(screen.height), - width: parseInt(screen.width) - } - } - container.setStyles(containerSize); - - var editorProperties = {zoom:0.85,saveOnLoad:true,collab:'standalone',readOnly:viewMode}; - designer = new mindplot.Designer(editorProperties, container); + designer = new mindplot.Designer(options, container); designer.setViewPort({ height: parseInt(window.innerHeight - 70), // Footer and Header width: parseInt(window.innerWidth) }); - if (!viewMode) { + if (!options.readOnly) { if ($('toolbar')) { - var menu = new mindplot.widget.Menu(designer, 'toolbar', mapId); + var menu = new mindplot.widget.Menu(designer, 'toolbar'); // If a node has focus, focus can be move to another node using the keys. designer._cleanScreen = function() { @@ -52,4 +42,38 @@ function buildDesigner(viewMode, containerSize) { return designer; } + +function loadDesignerOptions() { + // Load map options ... + var uri = new URI(window.location); + var query = String.parseQueryString(uri.get('query')); + var jsonConf = query.confUrl; + var result; + if (jsonConf) { + + var request = new Request.JSON({ + url: jsonConf, + async:false, + onSuccess: + function(options) { + this.options = options; + + }.bind(this) + } + ); + request.get(); + result = this.options; + } + else { + // Set workspace screen size as default. In this way, resize issues are solved. + var containerSize = { + height: parseInt(screen.height), + width: parseInt(screen.width) + }; + result = {readOnly:true,zoom:0.85,saveOnLoad:true,size:containerSize}; + } + return result; +} + + Asset.javascript("../js/mindplot-min.js");