Skip to content

Commit

Permalink
Added the ability to specify server url
Browse files Browse the repository at this point in the history
  • Loading branch information
MaazAli committed Jan 29, 2015
1 parent 5e834d5 commit ea6f526
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h3>Keyboard shortcuts:</h3>

<p>Enjoy focusing on your content and not worrying about formatting!</p>
</article>

<div class="demo-buttons">
<a id="settings-btn"><i class="icon-settings"></i></a>
</div>
Expand All @@ -77,6 +77,5 @@ <h3>Keyboard shortcuts:</h3>

<!-- JS just for the demo page -->
<script src="demo.js"></script>

</body>
</html>
9 changes: 8 additions & 1 deletion src/js/content-kit-editor/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var defaults = {
spellcheck: true,
autofocus: true,
model: null,
serverUrl: '',
stickyToolbar: !!('ontouchstart' in window),
textFormatCommands: [
new BoldCommand(),
Expand Down Expand Up @@ -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);
Expand All @@ -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(); }
}
}
Expand Down

0 comments on commit ea6f526

Please sign in to comment.