diff --git a/README.md b/README.md
index a98a1d3..62a83f5 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,18 @@
# This is a HTML code editor.
This is a customize MediumEditor with the additional features than other Edit.
User can generate all html contents by using special pattern.
-
-- How to create img elements
+Live URL: https://medium-editor-3379b.firebaseapp.com
+- How to create img and video elements
- []
+ ```[]```
+
+ ```[@[video caption](video url)]```
Example:
+ ```[]```
[]
- 
+ ```[@[video caption](video url)]```
## Main features
@@ -28,4 +31,4 @@ User can generate all html contents by using special pattern.
$ cd vikids_editor
$ npm install
-
\ No newline at end of file
+
diff --git a/app.js b/app.js
new file mode 100644
index 0000000..6bdf727
--- /dev/null
+++ b/app.js
@@ -0,0 +1,13 @@
+let express = require('express')
+let path = require('path')
+
+let app = express()
+const port = 3000;
+app.use(express.static(path.join(__dirname, '/')));
+
+
+app.get('/', (req, res) => {
+ res.sendFile('index.html', {root: __dirname })
+})
+
+app.listen(port, () => { console.log('You app running on', port) })
\ No newline at end of file
diff --git a/assests/js/custom.js b/assests/js/custom.js
index a81e0b9..cede792 100644
--- a/assests/js/custom.js
+++ b/assests/js/custom.js
@@ -8,6 +8,6 @@ var editor = new MediumEditor('.editable', {
$(function () {
$('.editable').mediumInsert({
- editor: editor
+ editor: editor,
});
});
diff --git a/assests/js/lib/embed/core.js b/assests/js/lib/embed/core.js
index 2dd25a8..c5abcc4 100755
--- a/assests/js/lib/embed/core.js
+++ b/assests/js/lib/embed/core.js
@@ -42,7 +42,8 @@
this.$el = $(el);
this.templates = window.MediumInsert.Templates;
this.extend = new Extend();
- this.targetEl = ''
+ this.targetEl = '',
+ this.ctTime = null;
if (options) {
// Fix #142
@@ -113,6 +114,7 @@
this.$el
.on('dragover drop', function (e) {
e.preventDefault();
+ $.proxy(that, 'dragDropAction')(e)
})
.on('keyup click', $.proxy(this, 'toggleButtons'))
.on('selectstart mousedown', '.medium-insert, .medium-insert-buttons', $.proxy(this, 'disableSelection'))
@@ -297,6 +299,10 @@
that.$el[addonName](options);
that.options.addons[addon] = that.$el.data('plugin_' + addonName).options;
});
+
+ this.$el.append(this.templates['src/js/templates/images-fileupload.hbs']());
+ this.$el.find('input:file').hide();
+ this.$el.data('plugin_' + pluginName + ucfirst('images'))['add'](true);
};
/**
@@ -521,7 +527,6 @@
*/
Core.prototype.toggleAddons = function () {
- console.log('insert new medias (core->toglleAddons)')
if (this.$el.find('.medium-insert-buttons').attr('data-active-addon') === 'images') {
this.$el.find('.medium-insert-buttons').find('button[data-addon="images"]').click();
return;
@@ -552,13 +557,35 @@
*/
Core.prototype.addonAction = function (e) {
- console.log('select any media type here', e.currentTarget)
var $a = $(e.currentTarget),
addon = $a.data('addon'),
action = $a.data('action');
this.$el.data('plugin_' + pluginName + ucfirst(addon))[action]();
};
+
+ /**
+ * Call drag-drop's action
+ *
+ * @param {Event} e
+ * @return {void}
+ */
+
+ Core.prototype.dragDropAction = function (e) {
+
+ const targetElement = e.target;
+ if(e.type === 'drop') {
+ this.$el.find('.medium-insert-active').removeClass('medium-insert-active');
+ this.$el.find('.medium-insert-embeds-active').removeClass('medium-insert-embeds-active');
+ e.target.click();
+
+ const newMediaDiv = document.createElement("div")
+ newMediaDiv.className = 'medium-insert-active'
+ targetElement.after(newMediaDiv);
+ }
+ };
+
+
/**
* Move caret at the beginning of the empty paragraph
*
@@ -702,11 +729,10 @@
*/
Core.prototype.embedMedia = function(data, that, result) {
- console.log('Validate Response successflully ===>', result, data)
-
if(result === 'success' && data.type === 'img') {
that.createEmptyMediaDiv(data, "medium-insert-active")
- that.$el.data('plugin_' + pluginName + ucfirst('images'))['uploadAdd'](data, {});
+
+ that.$el.data('plugin_' + pluginName + ucfirst('images'))['showImageByURL'](data);
}
if(result === 'success' && data.type === 'mov') {
@@ -811,9 +837,6 @@
const altText = matches[2]
const filePath = matches[3];
- console.log('template validate')
- console.log(`PatternType => ${mediaType}, AltText => ${altText}, FilePath => ${filePath}`)
-
// check if the current file is valid media file
const fileURLValidate= this.checkMediaUrlParse(mediaType, filePath)
if (fileURLValidate) {
@@ -841,20 +864,80 @@
})();
};
+ Core.prototype.getCursorPosition = function (element) {
+ element = element || document.querySelector('.editable')
+ var caretOffset = 0;
+ var preCaretRange = '';
+ var doc = element.ownerDocument || element.document;
+ var win = doc.defaultView || doc.parentWindow;
+ var sel;
+ if (typeof win.getSelection != "undefined") {
+ sel = win.getSelection();
+ if (sel.rangeCount > 0) {
+ var range = win.getSelection().getRangeAt(0);
+ preCaretRange = range.cloneRange();
+ preCaretRange.selectNodeContents(element);
+ preCaretRange.setEnd(range.endContainer, range.endOffset);
+ caretOffset = preCaretRange.toString().length;
+ }
+ } else if ( (sel = doc.selection) && sel.type != "Control") {
+ var textRange = sel.createRange();
+ var preCaretTextRange = doc.body.createTextRange();
+ preCaretTextRange.moveToElementText(element);
+ preCaretTextRange.setEndPoint("EndToEnd", textRange);
+ caretOffset = preCaretTextRange.text.length;
+ }
+
+ return {point: caretOffset, text: preCaretRange.toString()}
+ }
+
+ Core.prototype.getAllTextnodes = function (el) {
+ el = el || document.querySelector('.editable')
+ var n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false);
+ while(n=walk.nextNode()) a.push(n);
+ return a;
+ }
+
+ Core.prototype.getCursorData = function (el, position){
+ el = el || document.querySelector('.editable')
+ var node, nodes = this.getAllTextnodes(el);
+ for(var n = 0; n < nodes.length; n++) {
+ if (position > nodes[n].nodeValue.length && nodes[n+1]) {
+ // remove amount from the position, go to next node
+ position -= nodes[n].nodeValue.length;
+ } else {
+ node = nodes[n];
+ break;
+ }
+ }
+ // you'll need the node and the position (offset) to set the caret
+ return { node: node, position: position };
+ }
+
+ Core.prototype.setCursorPosition = function (d) {
+ var sel = window.getSelection(),
+ range = document.createRange();
+ range.setStart(d.node, d.position);
+ range.collapse(true);
+ sel.removeAllRanges();
+ sel.addRange(range);
+ }
+
+ Core.prototype.checkInputMediaToolbar = function () {
+ const cPoint = this.getCursorPosition();
+ const cPointDetail = this.getCursorData(null, cPoint.point);
+
+ // cPointDetail.node.parentElement.replaceChild('
New heading
');
+
+ }
+
Core.prototype.checkCustomPattern = function () {
var an = window.getSelection().anchorNode;
this.targetEl = $(an.parentElement);
-
- // var $place1 = this.$el.find('.medium-insert-images');
- // var $place2 = this.$el.find('.medium-insert-embeds-active');
- // console.log(this.$el)
- // console.log($place1)
- // console.log($place2)
-
+ this.checkInputMediaToolbar();
// Parsed element data || false
const templateValidate = this.checkTemplateValidate();
- console.log('template validate', templateValidate)
if (templateValidate) {
const mediaTyepe = templateValidate.type;
const mediaPath = templateValidate.url;
@@ -869,23 +952,17 @@
}
}
-
- Core.prototype.simulateKeydown = function (el, keycode, isCtrl, isAlt, isShift) {
- var e = new KeyboardEvent( "keydown", { bubbles:true, cancelable:true, char:String.fromCharCode(keycode), key:String.fromCharCode(keycode), shiftKey:isShift, ctrlKey:isCtrl, altKey:isAlt } );
- Object.defineProperty(e, 'keyCode', {get : function() { return this.keyCodeVal; } });
- e.keyCodeVal = keycode;
- el.dispatchEvent(e);
- }
-
+
Core.prototype.capturePattern = function () {
- if(ctTime) {
- window.clearTimeout(ctTime)
- ctTime = null
- } else {
- ctTime = window.setTimeout(() => {
+ if(this.ctTime) {
+ window.clearTimeout(this.ctTime)
+ this.ctTime = null
+ }
+
+ this.ctTime = window.setTimeout(() => {
this.checkCustomPattern();
- }, 100);
- }
+ }, 500);
+
}
/** Plugin initialization */
diff --git a/assests/js/lib/embed/embeds.js b/assests/js/lib/embed/embeds.js
index a560b6f..f1c3719 100755
--- a/assests/js/lib/embed/embeds.js
+++ b/assests/js/lib/embed/embeds.js
@@ -26,7 +26,7 @@
label: ''
// added: function ($el) {},
// removed: function ($el) {}
- }
+ },
},
actions: {
remove: {
@@ -42,6 +42,11 @@
parseOnPaste: false
};
+
+ function ucfirst(str) {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+ }
+
/**
* Embeds object
*
@@ -56,7 +61,6 @@
function Embeds(el, options) {
- console.log('emped ===> @@@@@@@@@@@@@@')
this.el = el;
this.$el = $(el);
this.templates = window.MediumInsert.Templates;
@@ -177,7 +181,6 @@
*/
Embeds.prototype.add = function () {
- console.log('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')
var $place = this.$el.find('.medium-insert-active');
// Fix #132
@@ -267,9 +270,6 @@
*/
Embeds.prototype.processLink = function (e) {
- // console.log(this.core.capturePattern)
- console.log('------------ Embded ProcessLink ---------------')
-
var $place = this.$el.find('.medium-insert-embeds-active'),
url;
@@ -331,7 +331,6 @@
Embeds.prototype.oembed = function (url, pasted, altText) {
console.log('Embded->Oembed 335 ===>', url, pasted)
var that = this;
-
$.support.cors = true;
$.ajax({
@@ -344,14 +343,15 @@
},
success: function (data) {
var html = data && data.html;
- console.log('response data ===>', html)
if (that.options.storeMeta) {
html += '';
}
- if (data && !html && data.type === 'photo' && data.url) {
+ if (data && data.type.match(/(photo|rich)/) && data.url) {
+ that.$el.data('plugin_' + pluginName + ucfirst('images'))['showImageByURL']({type: 'image', url: data.url}, {});
html = '
';
+ return;
}
if (!html) {
@@ -432,10 +432,12 @@
*/
Embeds.prototype.embed = function (html, pastedUrl, altText) {
- var $place = this.$el.find('.medium-insert-embeds-active'),
+ var $place = this.$el.find('.medium-insert-embeds-active').length? this.$el.find('.medium-insert-embeds-active') : this.$el.find('.medium-insert-active'),
$div, that;
that = this;
+ $place.attr('class', 'medium-insert-embeds-active');
+
if (!html) {
alert('Incorrect URL format specified');
return false;
@@ -461,7 +463,6 @@
$place.after(this.templates['src/js/templates/embeds-wrapper.hbs']({
html: html
}));
-
$place.text($place.text().replace(pastedUrl, ''));
} else {
if(altText) {
@@ -728,7 +729,7 @@
$lis.find('button').each(function () {
var className = 'medium-insert-embeds-' + $(this).data('action');
-
+ console.log(className)
if ($(this).hasClass('medium-editor-button-active')) {
$embed.addClass(className);
diff --git a/assests/js/lib/embed/images.js b/assests/js/lib/embed/images.js
index 2c6f8d1..63622d1 100755
--- a/assests/js/lib/embed/images.js
+++ b/assests/js/lib/embed/images.js
@@ -10,14 +10,17 @@
defaults = {
label: '',
deleteMethod: 'POST',
- deleteScript: 'delete.php',
+ deleteScript: 'http://localhost:3000/delete',
preview: true,
captions: true,
captionPlaceholder: 'Type caption for image (optional)',
autoGrid: 3,
- fileUploadOptions: { // See https://github.com/blueimp/jQuery-File-Upload/wiki/Options
- url: null,
- acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
+ fileUploadOptions: {
+ // url: 'https://www.vikids.ru/medias',
+ url: 'http://localhost:3000/upload',
+ type: 'POST',
+ acceptFileTypes: /(\.|\/)(gif|jpe?g|png|mp4|avi|mpeg|)$/i,
+ sequentialUploads: true,
},
fileDeleteOptions: {},
styles: {
@@ -77,6 +80,10 @@
// uploadCompleted: function ($el, data) {}
};
+ function ucfirst(str) {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+ }
+
/**
* Images object
*
@@ -194,41 +201,48 @@
* @return {void}
*/
- Images.prototype.add = function () {
- var that = this,
- $file = $(this.templates['src/js/templates/images-fileupload.hbs']()),
- fileUploadOptions = {
- dataType: 'json',
- add: function (e, data) {
- $.proxy(that, 'uploadAdd', e, data)();
- },
- done: function (e, data) {
- $.proxy(that, 'uploadDone', e, data)();
- }
- };
-
- // Only add progress callbacks for browsers that support XHR2,
- // and test for XHR2 per:
- // http://stackoverflow.com/questions/6767887/
- // what-is-the-best-way-to-check-for-xhr2-file-upload-support
- if (new XMLHttpRequest().upload) {
- fileUploadOptions.progress = function (e, data) {
- $.proxy(that, 'uploadProgress', e, data)();
- };
-
- fileUploadOptions.progressall = function (e, data) {
- $.proxy(that, 'uploadProgressall', e, data)();
- };
+ Images.prototype.add = function (mediaData) {
+ if(mediaData) {
+ var that = this,
+ $file = $('input:file'),
+ fileUploadOptions = {
+ dataType: 'json',
+ replaceFileInput: true,
+ drop: function (e, data) {
+ // e.preventDefault();
+ },
+ add: function (e, data) {
+ $.proxy(that, 'uploadAdd', e, data)();
+ },
+ done: function (e, data) {
+ $.proxy(that, 'uploadDone', e, data)();
+ }
+ };
+
+ // Only add progress callbacks for browsers that support XHR2,
+ // and test for XHR2 per:
+ // http://stackoverflow.com/questions/6767887/
+ // what-is-the-best-way-to-check-for-xhr2-file-upload-support
+ if (new XMLHttpRequest().upload) {
+ fileUploadOptions.progress = function (e, data) {
+ $.proxy(that, 'uploadProgress', e, data)();
+ };
+
+ fileUploadOptions.progressall = function (e, data) {
+ $.proxy(that, 'uploadProgressall', e, data)();
+ };
+ }
+
+ $file.fileupload($.extend(true, {}, this.options.fileUploadOptions, fileUploadOptions));
+
+ } else {
+ var $file = $('input:file');
+ $file.click();
}
-
- $file.fileupload($.extend(true, {}, this.options.fileUploadOptions, fileUploadOptions));
-
- $file.click();
};
/**
* Callback invoked as soon as files are added to the fileupload widget - via file input selection, drag & drop or add API call.
- * https://github.com/blueimp/jQuery-File-Upload/wiki/Options#add
*
* @param {Event} e
* @param {object} data
@@ -243,65 +257,62 @@
acceptFileTypes = this.options.fileUploadOptions.acceptFileTypes,
maxFileSize = this.options.fileUploadOptions.maxFileSize,
reader;
+
+ if (acceptFileTypes && !acceptFileTypes.test(file.type)) {
+ uploadErrors.push(this.options.messages.acceptFileTypesError + file.name);
+ } else if (maxFileSize && file.size > maxFileSize) {
+ uploadErrors.push(this.options.messages.maxFileSizeError + file.name);
+ }
- if(file) {
- if (acceptFileTypes && !acceptFileTypes.test(file.type)) {
- uploadErrors.push(this.options.messages.acceptFileTypesError + file.name);
- } else if (maxFileSize && file.size > maxFileSize) {
- uploadErrors.push(this.options.messages.maxFileSizeError + file.name);
- }
+ if (uploadErrors.length > 0) {
+ if (this.options.uploadFailed && typeof this.options.uploadFailed === "function") {
+ this.options.uploadFailed(uploadErrors, data);
+ return;
+ }
- if (uploadErrors.length > 0) {
- if (this.options.uploadFailed && typeof this.options.uploadFailed === "function") {
- this.options.uploadFailed(uploadErrors, data);
- return;
- }
-
- alert(uploadErrors.join("\n"));
- return;
- }
-
- this.core.hideButtons();
-
- // Replace paragraph with div, because figure elements can't be inside paragraph
- if ($place.is('p')) {
- $place.replaceWith('' + $place.html() + '
');
- $place = this.$el.find('.medium-insert-active');
- if ($place.next().is('p')) {
- this.core.moveCaret($place.next());
- } else {
- $place.after('
'); // add empty paragraph so we can move the caret to the next line.
- this.core.moveCaret($place.next());
- }
- }
-
- $place.addClass('medium-insert-images');
-
- if (this.options.preview === false && $place.find('progress').length === 0 && (new XMLHttpRequest().upload)) {
- $place.append(this.templates['src/js/templates/images-progressbar.hbs']());
- }
-
- if (data.autoUpload || (data.autoUpload !== false && $(e.target).fileupload('option', 'autoUpload'))) {
- data.process().done(function () {
- // If preview is set to true, let the showImage handle the upload start
- if (that.options.preview) {
- reader = new FileReader();
-
- reader.onload = function (e) {
- $.proxy(that, 'showImage', e.target.result, data)();
- };
-
- reader.readAsDataURL(data.files[0]);
- } else {
- data.submit();
- }
- });
- }
- } else {
+ alert(uploadErrors.join("\n"));
+ return;
+ }
- $place.addClass('medium-insert-images');
- $.proxy(that, 'showImage', e, {})();
+ this.core.hideButtons();
+
+ // Replace paragraph with div, because figure elements can't be inside paragraph,
+ if ($place.is('p')) {
+ $place.replaceWith('' + $place.html() + '
');
+ $place = this.$el.find('.medium-insert-active');
+ if ($place.next().is('p')) {
+ this.core.moveCaret($place.next());
+ } else {
+ $place.after('
'); // add empty paragraph so we can move the caret to the next line.
+ this.core.moveCaret($place.next());
}
+ }
+
+ $place.addClass('medium-insert-images');
+
+ if (this.options.preview === false && $place.find('progress').length === 0 && (new XMLHttpRequest().upload)) {
+ $place.append(this.templates['src/js/templates/images-progressbar.hbs']());
+ }
+
+ if (data.autoUpload || (data.autoUpload !== false && $(e.target).fileupload('option', 'autoUpload'))) {
+
+ data.process().done(function () {
+ // If preview is set to true, let the showImage handle the upload start
+ if (that.options.preview) {
+ reader = new FileReader();
+
+ reader.onload = function (e) {
+ // first parameter is File content (data:image/jpeg;base64)
+ $.proxy(that, 'showImage', e.target.result, data)();
+ };
+
+ reader.readAsDataURL(data.files[0]);
+ } else {
+ // If preview is set to false, then do force upload
+ data.submit();
+ }
+ });
+ }
};
/**
@@ -315,7 +326,7 @@
Images.prototype.uploadProgressall = function (e, data) {
var progress, $progressbar;
-
+
if (this.options.preview === false) {
progress = parseInt(data.loaded / data.total * 100, 10);
$progressbar = this.$el.find('.medium-insert-active').find('progress');
@@ -340,6 +351,7 @@
*/
Images.prototype.uploadProgress = function (e, data) {
+
var progress, $progressbar;
if (this.options.preview) {
@@ -364,8 +376,14 @@
*/
Images.prototype.uploadDone = function (e, data) {
- $.proxy(this, 'showImage', data.result.files[0].url, data)();
-
+ if(data.result) {
+ if(data.result.type ==='img') {
+ $.proxy(this, 'showImage', data.result, data)();
+ } else {
+ // this.$el.data('plugin_' + pluginName + ucfirst('embeds'))['oembed'](data.result.url);
+ this.$el.data('plugin_' + pluginName + ucfirst('embeds'))['oembed']('https://www.youtube.com/watch?v=2Lwd46qBrqU');
+ }
+ }
this.core.clean();
this.sorting();
};
@@ -373,15 +391,16 @@
/**
* Add uploaded / preview image to DOM
*
- * @param {string} img
+ * @param {string} img // File data or File URL
* @returns {void}
*/
Images.prototype.showImage = function (img, data) {
+
var $place = this.$el.find('.medium-insert-active'),
domImage,
that;
-
+
// Hide editor's placeholder
$place.click();
@@ -390,8 +409,10 @@
that = this;
if (this.options.preview && data.context) {
domImage = this.getDOMImage();
+ const fileUrl = img.url.match(/(http|https):\/\//)? ima.url: `http://${img.url}`;
+
domImage.onload = function () {
- data.context.find('img').attr('src', img);
+ data.context.find('img').attr('src', fileUrl);
if (this.options.uploadCompleted) {
this.options.uploadCompleted(data.context, data);
@@ -399,7 +420,8 @@
that.core.triggerInput();
}.bind(this);
- domImage.src = img;
+ domImage.src = fileUrl;
+
} else {
data.context = $(this.templates['src/js/templates/images-image.hbs']({
img: typeof img === 'object'? img.url : img,
@@ -407,18 +429,6 @@
})).appendTo($place);
$place.find('br').remove();
-
- if (typeof img === 'object' && that.options.captions) {
- const $image = $place.find('img');
-
- img.alt?
- (()=>{
- that.core.addCaption($image.closest('figure'), that.options.captionPlaceholder)
- that.core.addCaptionContent($place, img.alt)
- })()
- :
- null;
- }
if (this.options.autoGrid && $place.find('figure').length >= this.options.autoGrid) {
$.each(this.options.styles, function (style, options) {
@@ -438,6 +448,7 @@
}
}
+ // Preview is to set as true, then upload media files here
if (this.options.preview) {
data.submit();
} else if (this.options.uploadCompleted) {
@@ -450,6 +461,58 @@
return data.context;
};
+ /**
+ * Display image to DOM
+ *
+ * @param {string} img // File data or File URL
+ * @returns {void}
+ */
+ Images.prototype.showImageByURL = function (img) {
+ var $place = this.$el.find('.medium-insert-active').length? this.$el.find('.medium-insert-active') : this.$el.find('.medium-insert-embeds-active'),
+ that = this;
+
+ $place.attr('class', 'medium-insert-active medium-insert-images');
+ $place.click();
+
+ $place[0].innerHTML = this.templates['src/js/templates/images-image.hbs']({
+ img: typeof img === 'object'? img.url : img,
+ progress: this.options.preview
+ })
+
+ $place.find('br').remove();
+
+ if (typeof img === 'object' && that.options.captions) {
+ const $image = $place.find('img');
+
+ img.alt?
+ (()=>{
+ that.core.addCaption($image.closest('figure'), that.options.captionPlaceholder)
+ that.core.addCaptionContent($place, img.alt)
+ })()
+ :
+ null;
+ }
+
+ if (this.options.autoGrid && $place.find('figure').length >= this.options.autoGrid) {
+ $.each(this.options.styles, function (style, options) {
+ var className = 'medium-insert-images-' + style;
+
+ $place.removeClass(className);
+
+ if (options.removed) {
+ options.removed($place);
+ }
+ });
+
+ $place.addClass('medium-insert-images-grid');
+
+ if (this.options.styles.grid.added) {
+ this.options.styles.grid.added($place);
+ }
+ }
+ this.core.triggerInput();
+ };
+
Images.prototype.getDOMImage = function () {
return new window.Image();
};
@@ -462,6 +525,7 @@
*/
Images.prototype.selectImage = function (e) {
+
var that = this,
$image;
@@ -494,6 +558,7 @@
*/
Images.prototype.unselectImage = function (e) {
+
var $el = $(e.target),
$image = this.$el.find('.medium-insert-image-active');
@@ -523,6 +588,7 @@
*/
Images.prototype.removeImage = function (e) {
+
var images = [],
$selectedImage = this.$el.find('.medium-insert-image-active'),
$parent, $empty, selection, range, current, caretPosition, $current, $sibling, selectedHtml, i;
diff --git a/assests/js/lib/embed/templates.js b/assests/js/lib/embed/templates.js
index f86b6cf..bc32731 100755
--- a/assests/js/lib/embed/templates.js
+++ b/assests/js/lib/embed/templates.js
@@ -80,7 +80,7 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-image.hbs"] = Handleb
return "\n
\n"
+ + "\" alt=\"\" class=\"editable-content\" />\n"
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.progress : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n";
},"useData":true});
diff --git a/assests/js/lib/embed/templates/images-image.hbs b/assests/js/lib/embed/templates/images-image.hbs
index 491a2e1..3999439 100755
--- a/assests/js/lib/embed/templates/images-image.hbs
+++ b/assests/js/lib/embed/templates/images-image.hbs
@@ -1,6 +1,7 @@
-
+{{!--
+ ddd
{{#if progress }}
{{/if}}
-
+ --}}
diff --git a/dist/js/medium-editor.js b/dist/js/medium-editor.js
index 38bb581..34a7d83 100644
--- a/dist/js/medium-editor.js
+++ b/dist/js/medium-editor.js
@@ -532,8 +532,6 @@ MediumEditor.extensions = {};
},
defaults: function defaults(/*dest, source1, source2, ...*/) {
- console.log(`1th -> 2th init->mergeoption->utils.default`)
-
var args = [false].concat(Array.prototype.slice.call(arguments));
return copyInto.apply(this, args);
},
diff --git a/firebase-debug.log b/firebase-debug.log
index de10f6a..ebf3a3b 100644
--- a/firebase-debug.log
+++ b/firebase-debug.log
@@ -23,3 +23,34 @@
[debug] [2019-01-21T07:44:31.054Z] <<< HTTP RESPONSE 200
[info] i hosting: Serving hosting files from: /
[info] ✔ hosting: Local server: http://localhost:5000
+[debug] [2019-01-17T15:36:50.645Z] ----------------------------------------------------------------------
+[debug] [2019-01-17T15:36:50.647Z] Command: /usr/local/Cellar/node/11.6.0/bin/node /usr/local/bin/firebase serve
+[debug] [2019-01-17T15:36:50.647Z] CLI Version: 6.3.0
+[debug] [2019-01-17T15:36:50.647Z] Platform: darwin
+[debug] [2019-01-17T15:36:50.647Z] Node Version: v11.6.0
+[debug] [2019-01-17T15:36:50.648Z] Time: Thu Jan 17 2019 09:36:50 GMT-0600 (Central Standard Time)
+[debug] [2019-01-17T15:36:50.649Z] ----------------------------------------------------------------------
+[debug]
+[debug] [2019-01-17T15:36:50.658Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
+[debug] [2019-01-17T15:36:50.658Z] > authorizing via signed-in user
+[debug] [2019-01-17T15:36:50.659Z] [iam] checking project medium-editor-3379b for permissions ["firebase.projects.get"]
+[debug] [2019-01-17T15:36:50.660Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
+[debug] [2019-01-17T15:36:50.660Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
+
+[debug] [2019-01-17T15:36:51.319Z] <<< HTTP RESPONSE 200
+[debug] [2019-01-17T15:36:51.355Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/medium-editor-3379b:testIamPermissions
+
+[debug] [2019-01-17T15:36:52.640Z] <<< HTTP RESPONSE 200
+[debug] [2019-01-17T15:36:52.641Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/medium-editor-3379b
+
+[debug] [2019-01-17T15:36:53.675Z] <<< HTTP RESPONSE 200
+[info]
+[info] === Serving from '/Volumes/work/Projects/Mikhail/vikids_editor'...
+[info]
+[debug] [2019-01-17T15:36:53.676Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/207703689499/clients/_:getWebAppConfig
+
+[debug] [2019-01-17T15:36:55.166Z] <<< HTTP RESPONSE 200
+[info] i hosting: Serving hosting files from: /
+[info] ✔ hosting: Local server: http://localhost:5000
+[info] Shutting down...
+[info] Shutting down...
diff --git a/index.html b/index.html
index a59c9d9..3098d77 100644
--- a/index.html
+++ b/index.html
@@ -64,15 +64,13 @@ Advanced Medium Editor
-
+
diff --git a/package.json b/package.json
index 16046d5..529a9cb 100644
--- a/package.json
+++ b/package.json
@@ -74,7 +74,7 @@
},
"scripts": {
"build": "node node_modules/grunt-cli/bin/grunt",
- "start": "open ./index.html",
+ "start": "nodemon app.js",
"serve": "firebase serve",
"deploy": "firebase deploy",
"test": "node node_modules/grunt-cli/bin/grunt test --verbose",
diff --git a/src/js/events.js b/src/js/events.js
index 858aabc..06fb1df 100644
--- a/src/js/events.js
+++ b/src/js/events.js
@@ -153,7 +153,7 @@
},
triggerCustomEvent: function (name, data, editable) {
- if (this.customEvents[name] && !this.disabledEvents[name]) {
+ if (this.customEvents[name] && !this.disabledEvents[name]) {
this.customEvents[name].forEach(function (listener) {
listener(data, editable);
});
@@ -365,19 +365,19 @@
break;
case 'editableDrag':
// Detecting dragover and dragleave on the contenteditables
- this.attachToEachElement('dragover', this.handleDragging);
- this.attachToEachElement('dragleave', this.handleDragging);
- break;
- case 'editableDrop':
- // Detecting drop on the contenteditables
- this.attachToEachElement('drop', this.handleDrop);
- break;
- // TODO: We need to have a custom 'paste' event separate from 'editablePaste'
- // Need to think about the way to introduce this without breaking folks
- case 'editablePaste':
- // Detecting paste on the contenteditables
- this.attachToEachElement('paste', this.handlePaste);
+ // this.attachToEachElement('dragover', this.handleDragging);
+ // this.attachToEachElement('dragleave', this.handleDragging);
break;
+ // case 'editableDrop':
+ // // Detecting drop on the contenteditables
+ // this.attachToEachElement('drop', this.handleDrop);
+ // break;
+ // // TODO: We need to have a custom 'paste' event separate from 'editablePaste'
+ // // Need to think about the way to introduce this without breaking folks
+ // case 'editablePaste':
+ // // Detecting paste on the contenteditables
+ // this.attachToEachElement('paste', this.handlePaste);
+ // break;
}
this.listeners[name] = true;
},
diff --git a/src/js/extensions/file-dragging.js b/src/js/extensions/file-dragging.js
index 9efc5a7..d6abc66 100644
--- a/src/js/extensions/file-dragging.js
+++ b/src/js/extensions/file-dragging.js
@@ -1,6 +1,5 @@
-(function () {
+;(function ($, document, window) {
'use strict';
-
var CLASS_DRAG_OVER = 'medium-editor-dragover';
function clearClassNames(element) {
@@ -87,4 +86,4 @@
});
MediumEditor.extensions.fileDragging = FileDragging;
-}());
+})($, document, window);
diff --git a/src/js/util.js b/src/js/util.js
index 7f56d8c..b583efd 100644
--- a/src/js/util.js
+++ b/src/js/util.js
@@ -124,7 +124,6 @@
},
defaults: function defaults(/*dest, source1, source2, ...*/) {
- console.log(`5th -> utils.default`)
var args = [false].concat(Array.prototype.slice.call(arguments));
return copyInto.apply(this, args);
},