Skip to content

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

@stevie-p

Description

@stevie-p

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions