Code Monkey home page Code Monkey logo

Comments (11)

rvdkooy avatar rvdkooy commented on July 16, 2024

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.

rvdkooy avatar rvdkooy commented on July 16, 2024

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.

rvdkooy avatar rvdkooy commented on July 16, 2024

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.

wintermuted avatar wintermuted commented on July 16, 2024

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.

rvdkooy avatar rvdkooy commented on July 16, 2024

My pull request for this issue was accepted and this fix should now be part of the latest version.

from ui-tinymce.

wintermuted avatar wintermuted commented on July 16, 2024

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.

rvdkooy avatar rvdkooy commented on July 16, 2024

can you setup a fiddle with your particular use-case, so I can take a quick look at it?

from ui-tinymce.

wintermuted avatar wintermuted commented on July 16, 2024

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.

rajasaur avatar rajasaur commented on July 16, 2024

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.

wesleycho avatar wesleycho commented on July 16, 2024

Can someone verify whether this is still an issue with the latest tagged release?

from ui-tinymce.

wesleycho avatar wesleycho commented on July 16, 2024

Closing as I believe this is outdated. Feel free to comment if this is not the case.

from ui-tinymce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.