Skip to content
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

Q / feature request: Can contents be compiled? #67

Open
stevie-p opened this issue Aug 25, 2016 · 0 comments
Open

Q / feature request: Can contents be compiled? #67

stevie-p opened this issue Aug 25, 2016 · 0 comments

Comments

@stevie-p
Copy link

stevie-p commented Aug 25, 2016

Hi. I am road-testing angular-medium-editor to see whether I can use (and extend) it to deliver an online editing capability for users to add custom angular directives to their content.

Using the highlighter example, I can see how I can add custom HTML tags, attributes and classes - so I think I'm half-way there!

But is it possible for the contents of the medium-editor (and the custom directives inserted within it) to be compiled when they're changed?

I have tried editing angular-medium-editor.js to compile the contents as part of the ngModel.$render function:

    ngModel.$render = function() {
      iElement.html(ngModel.$viewValue || "");
      $compile(iElement.contents())(scope);
      var placeholder = ngModel.editor.getExtensionByName('placeholder');
      if (placeholder) {
        placeholder.updatePlaceholder(iElement[0]);
      }
    };

This works for custom directives that are already in the medium-editor's HTML model, but does not get re-compiled when the model changes (i.e. directives are added). Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant