rangy icon indicating copy to clipboard operation
rangy copied to clipboard

Cannot set dynamic values to ClassApplier properties

Open azoof-ahmed opened this issue 4 years ago • 1 comments

I tried to assign a variable and a function returning a string to the elementProperties and it doesn't work. When setting attempting to use a function it sets the function definition in string format o_O and setting a variable does nothing when its clearly got a value

highlighter.addClassApplier(
      rangy.createClassApplier('note', {
        ignoreWhiteSpace: true,
        elementTagName: 'a',
        elementProperties: {
          href: '#',
          title: noteText,
        },
      })
    );

azoof-ahmed avatar Dec 13 '20 06:12 azoof-ahmed

https://github.com/timdown/rangy/blob/1e55169d2e4d1d9458c2a87119addf47a8265276/src/modules/rangy-classapplier.js#L557

issue with this line. forces whatever is passed to turn into a string. Wouldn't it be better to just check if the value or whatever is passed is a string instead of doing this

azoof-ahmed avatar Dec 15 '20 18:12 azoof-ahmed