Skip to content

Commit

Permalink
stub drag and drop
Browse files Browse the repository at this point in the history
  • Loading branch information
gpoitch committed Sep 1, 2014
1 parent 0f157ea commit 76e465c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
19 changes: 15 additions & 4 deletions dist/content-kit-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2020,6 +2020,20 @@ define("content-kit-editor/editor/editor",
});
}

function bindDragAndDrop(editor) {
// Use these to add/remove classes
// window.addEventListener('dragenter', function(e) { });
// window.addEventListener('dragleave', function(e) { });

window.addEventListener('dragover', function(e) {
e.preventDefault(); // prevents showing cursor where to drop
});

window.addEventListener('drop', function(e) {
e.preventDefault(); // prevent page from redirecting
});
}

function bindLiveUpdate(editor) {
editor.element.addEventListener('input', function(e) {
editor.syncModel();
Expand Down Expand Up @@ -2093,6 +2107,7 @@ define("content-kit-editor/editor/editor",
bindContentEditableTypingCorrections(editor);
bindPasteListener(editor);
bindAutoTypingListeners(editor);
bindDragAndDrop(editor);
bindLiveUpdate(editor);
initEmbedCommands(editor);

Expand Down Expand Up @@ -2175,10 +2190,6 @@ define("content-kit-editor/editor/editor",
this.textFormatToolbar.addCommand(command);
};

Editor.prototype.text = function() {
getCursorIndexInSelectionBlockElement();
}

__exports__["default"] = Editor;
});
define("content-kit-editor/utils/element-utils",
Expand Down
19 changes: 15 additions & 4 deletions src/js/content-kit-editor/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ function bindAutoTypingListeners(editor) {
});
}

function bindDragAndDrop(editor) {
// Use these to add/remove classes
// window.addEventListener('dragenter', function(e) { });
// window.addEventListener('dragleave', function(e) { });

window.addEventListener('dragover', function(e) {
e.preventDefault(); // prevents showing cursor where to drop
});

window.addEventListener('drop', function(e) {
e.preventDefault(); // prevent page from redirecting
});
}

function bindLiveUpdate(editor) {
editor.element.addEventListener('input', function(e) {
editor.syncModel();
Expand Down Expand Up @@ -166,6 +180,7 @@ function Editor(element, options) {
bindContentEditableTypingCorrections(editor);
bindPasteListener(editor);
bindAutoTypingListeners(editor);
bindDragAndDrop(editor);
bindLiveUpdate(editor);
initEmbedCommands(editor);

Expand Down Expand Up @@ -248,8 +263,4 @@ Editor.prototype.addTextFormat = function(opts) {
this.textFormatToolbar.addCommand(command);
};

Editor.prototype.text = function() {
getCursorIndexInSelectionBlockElement();
}

export default Editor;

0 comments on commit 76e465c

Please sign in to comment.