question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add editor HTML element to plugin bindings

See original GitHub issue

@stevermeister what do you think about passing the HTML element that hosts the editor in the bindings property of ngWigPlugin? In that way, we could overcome difficulties that appear when using multiple editors in a template and simplify the way to find in which editor the plugin belongs to.

For example, in clear-styles plugin, we use the following to find the actual editor element:

var ngWigElement = e.target.parentElement.parentElement.parentElement.parentElement.parentElement;
var container = angular.element(ngWigElement.querySelector('#ng-wig-editable'));

which is really error prone and difficult to read and test. It could be changed to something like:

var container = angular.element(this.hostElement);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
stevermeistercommented, Jul 20, 2016
let div = document.createElement('div')
div.innerHTML = ngModel;
ngModel = div.textContent
0reactions
bampakoacommented, Jul 20, 2016

I really like your approach. Never thought of it! It is also much more testable. I will make the change and submit a PR for that. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event binding on dynamically created elements?
The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event...
Read more >
Binding HTML to a Page Elements in Creatio (formerly bpm ...
First of all, one thing to mention, if you want the bound HTML to be editable, you can simply bind the property containing...
Read more >
The "html" binding - Knockout.js
The html binding causes the associated DOM element to display the HTML specified by your parameter. Typically this is useful when values in...
Read more >
lit-plugin - Visual Studio Marketplace
Extension for Visual Studio Code - Syntax highlighting, type checking and code completion for lit-html.
Read more >
Adding custom code in the Builder.io visual editor
The Builder editor allows you to add event handlers, bind to state and even add custom JavaScript that will run on your page....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found