vue-at icon indicating copy to clipboard operation
vue-at copied to clipboard

ability to pull out RAW values.

Open anlek opened this issue 6 years ago • 6 comments

I have a situation where I want to be about to have text input that looks like this:

I believe @andrew likes cars more then toys, while @jill33 wants toys over cars.

but I want the raw output to look something like this:

[
  'I believe ', 
  {id: 1, firstName: 'Andrew', username: 'andrew' }, 
  ' likes cars more then toys, whille ', 
  {id: 3, firstName: 'Jill', username: 'jill33'}, 
  ' wants toys over cars.'
]

This way, I can submit the raw output to a database and can always re-render the users based on their ID. This way if Andrew renames himself to Draw, I can make this changes to the old content.

Thoughts on that posibility?

anlek avatar Aug 16 '18 22:08 anlek

@anlek vue-at doesn't do that thing for us 😆 - it's just a decorator/helper on textareas. it'd be better we have our own functions to transform before/after the text-rendering, as you said above?

fritx avatar Aug 19 '18 12:08 fritx

Hello @fritx, I agree the rendering should be done outside the vue-at but the text array generated could be done with vue-at as it is based on the text entered via the helper.

anlek avatar Aug 21 '18 15:08 anlek

There is no "text array", vue-at just helps us type and @people in the editor If I'm missing anything xD I'm a bit long away from the library, my bad

fritx avatar Aug 22 '18 06:08 fritx

No worries, I thought I'd ask just to see if it was possible. Right now I'm parsing the HTML content form the contentedtiable area in the backend into the array format mentioned above. It would be lovely if the Vue-at could do that for me in the feature.

anlek avatar Aug 22 '18 19:08 anlek

as long as the text following the @ sign is unique, the way you're doing it sounds optimal. Another solution is to have a post-processing command that maintains a shadow input field. I made a pull request for a processItem function a few months ago, and that might be a good place to insert the json that you are talking about.

mankowitz avatar Aug 27 '18 16:08 mankowitz

Did you mean PR https://github.com/fritx/vue-at/pull/47 ? I would try to have a look again and merge it soon. @mankowitz


There are still problems in that PR, and also I can't get the point relative to this issue 😓

fritx avatar Sep 06 '18 06:09 fritx