Comments (11)
When listening for the setContent event in the directive my editor does show my already stored values when binding the model.
After some investigation I found out that when the editor initally loads, it fires the setContent method but the actual value of the element is string empty at that time.
The argument that is passed to the setContent method during init/load contains 2 extra properties:
- initial --> true
- load --> true
you can check the initial value for false to update the viewmodel
example:
ed.on('SetContent', function (e) {
if (!e.initial) {
ed.save();
updateView();
}
});
now it works for me...
from ui-tinymce.
More investigation found out that the editor.load is doing a
self.setContent(elm.value !== undefined ? elm.value : elm.innerHTML, args);
In my case the value and the innerHtml was always an empty string, even when using the ngModel
when I implemented my textarea as:
[textarea ui-tinymce="defaultTinyMceConfig" ng-model="model.Text" ]{{ model.Text }}[/textarea]
it suddenly works fine
strange, maybe something to do with my angular version, I will try to update it and will report back
from ui-tinymce.
No luck with updating angular or tinymce, so I did a pull request with my change to check for initial load
Lets wait and see.
from ui-tinymce.
After reading this thread, I think my issue is exactly the same as the one I posted here: #42
Have you guys found any resolution to this issue as of yet?
from ui-tinymce.
My pull request for this issue was accepted and this fix should now be part of the latest version.
from ui-tinymce.
I took a look at your pull request, and it seems to be working fine. The problem with my use case seems to be with the Exec Command event. Whenever I try to format something via the toolbar, the command runs, but my ng-model is not updated. Alternatively, when the keyUp method executes, the model does update.
This is what the code looks like for Exec Command.
ed.on('ExecCommand', function (e) {
console.log("Exec Command");
ed.save();
updateView();
});
The only way that I've been able to get formatting into ng-model to submit to my rest service is to apply the formatting and then affect a keyUp event. When I do things in this order, the formatting is carried through.
from ui-tinymce.
can you setup a fiddle with your particular use-case, so I can take a quick look at it?
from ui-tinymce.
Hi, Sorry for the delay. I was able to get my use case working using a jQuery kludge in the meantime. This definitely is not a long term solution, but works for now. I'll work on getting a fiddle up in the next few days, once I can strip out all of my project's other dependencies.
This was the kludge:
var ed = $(".textarea_input")[0];
var result = ed.value;
from ui-tinymce.
If we listen on the "SetAttrib" event, then any plugins that change attributes (link/image etc.) will also update the model. For e.g. if u use the image plugin and update the link or alt text, then the attributes get changed and a "SetAttrib" event is fired.
The one case where I have not been able to fix is when you change just the link's text, in which case the link plugin just updates the innerText and doesnt call anything else. For most others, SetAttrib seems to work.
Here is my added event:
ed.on('SetAttrib', function (e) {
ed.save();
updateView();
});
from ui-tinymce.
Can someone verify whether this is still an issue with the latest tagged release?
from ui-tinymce.
Closing as I believe this is outdated. Feel free to comment if this is not the case.
from ui-tinymce.
Related Issues (20)
- Bower main file should be angular-ui-tinymce.js HOT 1
- Can't acces editor instance by ID HOT 2
- how to set dynamically tinymce in readonly mode ? HOT 2
- Placeholder-plugin HOT 2
- upgrade tinymce to 4.7.1 (from ~4.5.1)
- On setup, sets form as pristine
- Unable to add multiple editor HOT 1
- Tinymce in different tabs of bootstrap doesnt work
- Theme is not a constructor HOT 2
- Copy/Past HOT 3
- AngularJS directive/component in model
- how to uploadimge in local?
- using ui-tinymce with lazy loaded tynyMCE npm module HOT 2
- How to use "updateOn: 'blur'"?
- tinymce Option not working inside a custom directive HOT 1
- Is tinyMCE free library to use? HOT 1
- not showing properly tinymce editor HOT 2
- Hey I propose myself as a maintainer HOT 2
- To be Maintainer
- Is it possible to add image/ file manager within the TinyMCE?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui-tinymce.