From ea6f526791c50f848f2aae66f8273bf3aa0fa368 Mon Sep 17 00:00:00 2001 From: Maaz Ali Date: Thu, 29 Jan 2015 14:22:29 -0500 Subject: [PATCH 1/2] Added the ability to specify server url --- demo/index.html | 3 +-- src/js/content-kit-editor/editor/editor.js | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/demo/index.html b/demo/index.html index d289be19a..1e4a81e01 100644 --- a/demo/index.html +++ b/demo/index.html @@ -51,7 +51,7 @@

Keyboard shortcuts:

Enjoy focusing on your content and not worrying about formatting!

- +
@@ -77,6 +77,5 @@

Keyboard shortcuts:

- diff --git a/src/js/content-kit-editor/editor/editor.js b/src/js/content-kit-editor/editor/editor.js index 73f64f2b5..ca4f6b2ad 100644 --- a/src/js/content-kit-editor/editor/editor.js +++ b/src/js/content-kit-editor/editor/editor.js @@ -26,6 +26,7 @@ var defaults = { spellcheck: true, autofocus: true, model: null, + serverUrl: '', stickyToolbar: !!('ontouchstart' in window), textFormatCommands: [ new BoldCommand(), @@ -165,6 +166,12 @@ function Editor(element, options) { var editor = this; mergeWithOptions(editor, defaults, options); + // Update embed commands by prepending the serverUrl + editor.embedCommands = [ + new ImageCommand({ serviceUrl: editor.serverUrl + '/upload' }), + new OEmbedCommand({ serviceUrl: editor.serverUrl + '/embed' }) + ]; + if (element) { applyClassName(element); applyPlaceholder(element, editor.placeholder); @@ -186,7 +193,7 @@ function Editor(element, options) { editor.textFormatToolbar = new TextFormatToolbar({ rootElement: element, commands: editor.textFormatCommands, sticky: editor.stickyToolbar }); editor.linkTooltips = new Tooltip({ rootElement: element, showForTag: Type.LINK.tag }); - + if(editor.autofocus) { element.focus(); } } } From 284310552368b61627a61deb1335c36f6e07b9a7 Mon Sep 17 00:00:00 2001 From: Maaz Ali Date: Thu, 29 Jan 2015 14:30:03 -0500 Subject: [PATCH 2/2] serverUrl property changed to serverHost --- src/js/content-kit-editor/editor/editor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/content-kit-editor/editor/editor.js b/src/js/content-kit-editor/editor/editor.js index ca4f6b2ad..9f288a525 100644 --- a/src/js/content-kit-editor/editor/editor.js +++ b/src/js/content-kit-editor/editor/editor.js @@ -26,7 +26,7 @@ var defaults = { spellcheck: true, autofocus: true, model: null, - serverUrl: '', + serverHost: '', stickyToolbar: !!('ontouchstart' in window), textFormatCommands: [ new BoldCommand(), @@ -166,10 +166,10 @@ function Editor(element, options) { var editor = this; mergeWithOptions(editor, defaults, options); - // Update embed commands by prepending the serverUrl + // Update embed commands by prepending the serverHost editor.embedCommands = [ - new ImageCommand({ serviceUrl: editor.serverUrl + '/upload' }), - new OEmbedCommand({ serviceUrl: editor.serverUrl + '/embed' }) + new ImageCommand({ serviceUrl: editor.serverHost + '/upload' }), + new OEmbedCommand({ serviceUrl: editor.serverHost + '/embed' }) ]; if (element) {