-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration with orthes/medium-editor-insert-plugin? #59
Comments
+1 |
Yes. ngModel.editor = new MediumEditor(iElement, scope.bindOptions);
$('.editable').mediumInsert({
addons: {
images: {
uploadScript: null,
deleteScript: null,
captionPlaceholder: 'Descripción de imagen',
styles: {
slideshow: {
label: '<span class="fa fa-play"></span>',
added: function ($el) {
$el
.data('cycle-center-vert', true)
.cycle({
slides: 'figure'
});
},
removed: function ($el) {
$el.cycle('destroy');
}
}
},
actions: null
}
}
}); For now, there's no medium-insert-plugin standalone nor angular; it really needs jQuery. |
Would love this to happen, I really don't want to use jQuery with my angular application. +1 |
cant wait for this |
+1 |
1 similar comment
+1 |
Hi matikbird, I added your code but it says "mediumEditor is undefined" in images.js (line 596, col 13). I am using latest versions of plugins. When I add below js code before angular-medium-plugin.js It works fine but at this time it looses binding on $scope.text. console.log($scope.text) always returns the same result. var editor = new MediumEditor('.editable');
$(function () {
$('.editable').mediumInsert({
editor: editor
});
}); Is it possible you to add an example about the integration. I am missing something or the latest version of plugins does not work well with the code you added. |
I do something simple... sorta of the same but different from above. It doesn't quite solve the no jQuery issue. I add the insert plugin as a child element to directive.js(function(){
'use strict';
angular.module('angular-medium-editor-insert-plugin', [])
.directive('mediumInsert', mediumInsert);
function mediumInsert() {
var directive = {};
directive.restrict = 'EA';
directive.scope = {insertAddons: '='}
directive.require = '^ngModel';
directive.link = linkFunction;
return directive;
function linkFunction(scope, elem, attr, ngModel) {
var editor = $('medium-editor').length ? $('medium-editor') : $('[medium-editor]');
editor.mediumInsert({
editor: ngModel.editor,
addons: scope.insertAddons,
})
}
}
})(); index.html<div name="text" ng-model="text" medium-editor>
<div medium-insert insert-addons="insertAddons"></div>
</div> controller.js
If you need to modify the addons you can put it in the |
@himynameistimli |
If you're using the code above then you should probably add the directive to your existing directive file structure.
Maybe if you share your implementation? |
@himynameistimli |
Hi sorry for the delay. It's hard to say without looking at it more closely. Can you use the non minified version of medium-editor-insert-plugin to better diagnose the issue? Best thing would be to put some code somewhere (a codepen or something) to make it easier to debug |
@himynameistimli , will my own app name replace this |
@himynameistimli , your directive is working fine for me, the only problem I got, when I uploaded an image, the tags(image tags and other) are not appended with the html of the angular-medium-editor in the $scope variable (in my controller)
angular-medium-editor-insert-plugin do not update the ng-model 'article'. |
Hey guys, sorry for the issues. I put up a plunker with my code. I figured out the issue that you guys are facing. It has to do with the directive loading before the element is fully loaded. To counter it, I just wrapped the directive in a timeout, but I think this may not be the best way. What do you guys think? Here's the plunker: https://plnkr.co/edit/2jm6pvE5In7wMwFUJ3Gs?p=preview And here's the code in the scripts.js: angular.module('demo', ['angular-medium-editor'])
.directive('mediumInsert', mediumInsert)
.controller('demoController', demoController);
demoController.$inject = ['$scope'];
mediumInsert.$inject = ['$timeout'];
function demoController($scope) {
$scope.text = 'This text gets is shown via .$render()';
$scope.insertAddons = {
"images": {
"fileUploadOptions": {
"url": "new-upload.php"
}
}
}
}
function mediumInsert($timeout) {
var directive = {};
directive.restrict = 'EA';
directive.scope = {
insertAddons: '='
}
directive.require = '^ngModel';
directive.link = linkFunction;
return directive;
function linkFunction(scope, elem, attr, ngModel) {
$timeout(function() {
var editor = $('medium-editor').length ?
$('medium-editor') : $('[medium-editor]');
editor.mediumInsert({
editor: ngModel['editor'],
addons: scope.insertAddons,
})
});
}
} |
Actually I'm using 3.0 branch, and somehow it's a nightmare in Electron. Can someone reproduce it? |
Hello @himynameistimli, Thanks for great job. |
@monkeymars how are you implementing |
@himynameistimli your directive works fine for me but the video doesn't play when returned from database. Its comes just like the preview image. I don't really know what to do here. |
@himynameistimli in the plunker above,
|
@goelrohan6 for images and embeds you can specify the upload location in In the end, I had to override the send / done functions (I used this fork https://github.com/malacalypse/medium-editor-insert-plugin/commit/f57916b9991e178165f07fe466a126eb8d32e7ad) I can't remember the datauri vs blob thing. I think blob? See https://github.com/blueimp/jQuery-File-Upload/wiki/Options for more details. My config for images ended looking something like this: fileUploadOptions: {
url: baseRelativeUrl +'/images/',
headers: {
Authorization: 'Token ' + token,
Accept: 'application/json'
},
paramName: 'image',
send: function(e, data) {
// logic before sending to server
},
done: function(e, data) {
// logic when done
}
...
} If you have specific issues about your implementation, maybe share what you have so far? |
@himynameistimli $filename = $_FILES['file']['name'];
$meta = $_POST;
$destination = $meta['targetPath'].$filename;
move_uploaded_file($_FILES['file']['tmp_name'], $destination);
echo($filename." is moved to ". $destination); so I basically need to send one post parameter named targetPath and need to get the image file $scope.insertAddons = {
"images": {
"fileUploadOptions": {
"url": "http://upload.campusbox.org/mediumImageUpload.php",
"method": "POST",
"data": {
'targetPath': './media/'
}
}
}
} I am unable to get the image on the server and also not getting the post parameters what should i do to make it working |
Hello Sir, |
I have added my medium editor code:
|
Is there any way to integrate this wrapper with the orthes/medium-editor-insert-plugin?
I followed their instructions for installation and inclusion, but it looks like because I'm using this wrapper to initialize the editor its not working properly. Any experience or ideas?
The text was updated successfully, but these errors were encountered: