PublicLab.Editor icon indicating copy to clipboard operation
PublicLab.Editor copied to clipboard

Dragging in a CSV to generate a graph works in wysiwyg but not in markdown

Open jywarren opened this issue 7 years ago • 11 comments

in markdown, it is treated as a simple attachment -- the new mergeHtmlAndAttachment: function (chunks, link) { method is not invoked.

https://github.com/publiclab/PublicLab.Editor/pull/137/files#diff-a25f5d4b5c50e14d0bd66616d381892aR22318

Need to look through woofmark to see when it's triggered and if we can intercept an attachment insertion in wysiwyg mode too...

jywarren avatar May 02 '18 13:05 jywarren

In wysiwyg mode:
[graph:https://publiclab.org/system/images/photos/000/024/807/original/114634.csv]

In markdown mode:
  [attachment-1]: https://publiclab.org/system/images/photos/000/024/808/original/114634.csv "114634.csv"

Example csv to use: https://publiclab.org/system/images/photos/000/024/808/original/114634.csv

jywarren avatar May 02 '18 13:05 jywarren

Relevant code segment:

https://github.com/publiclab/PublicLab.Editor/blob/f5f5492e5188963b0d6b672fc60093cef34c065c/src/adapters/PublicLab.Woofmark.js#L140-L151

This seems to work when you /convert/ between markdown and woofmark, but not when you initially drag it in. Odd!

jywarren avatar May 02 '18 13:05 jywarren

Working this over here: https://github.com/bevacqua/woofmark/issues/67

jywarren avatar May 02 '18 15:05 jywarren

@jywarren The output we need in markdown is getting wrongly parsed in the editor. It seems right in the code. Attaching image. screenshot from 2019-02-02 13-21-34

sidntrivedi012 avatar Feb 02 '19 07:02 sidntrivedi012

Yes it seems we need to work on this upstream in the woofmark code, perhaps: https://github.com/bevacqua/woofmark/issues/67

jywarren avatar Feb 06 '19 15:02 jywarren

@jywarren Exactly. Should I make a issue there regarding this?

On Wed, 6 Feb 2019, 9:29 pm Jeffrey Warren, [email protected] wrote:

Yes it seems we need to work on this upstream in the woofmark code, perhaps: bevacqua/woofmark#67 https://github.com/bevacqua/woofmark/issues/67

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/publiclab/PublicLab.Editor/issues/142#issuecomment-461077012, or mute the thread https://github.com/notifications/unsubscribe-auth/AdvcXXwlWzIrfIZqAgBrEIfUDYztHT_eks5vKvvdgaJpZM4Tvc1R .

sidntrivedi012 avatar Feb 06 '19 17:02 sidntrivedi012

A workaround for this could be using crossvent to check if there's any .csv link present in the markdown and then convert that to a powertag. How does that sound?

rexagod avatar Feb 06 '19 17:02 rexagod

I think we can try to work it both ways... @sidntrivedi012 take a look at this, there was a suggestion for how to do it: https://github.com/bevacqua/woofmark/issues/67#issuecomment-386880691

And @rexagod would you be willing to try an implementation? Could we write a test against it to ensure it works?

jywarren avatar Feb 06 '19 22:02 jywarren

Sure @jywarren. Working on it already.

On Thu, 7 Feb 2019, 4:20 am Jeffrey Warren, [email protected] wrote:

I think we can try to work it both ways... @sidntrivedi012 https://github.com/sidntrivedi012 take a look at this, there was a suggestion for how to do it: bevacqua/woofmark#67 (comment) https://github.com/bevacqua/woofmark/issues/67#issuecomment-386880691

And @rexagod https://github.com/rexagod would you be willing to try an implementation? Could we write a test against it to ensure it works?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/PublicLab.Editor/issues/142#issuecomment-461219887, or mute the thread https://github.com/notifications/unsubscribe-auth/AdvcXaSG41wPl7rMEsQI-epSvE5EpFwnks5vK1w_gaJpZM4Tvc1R .

sidntrivedi012 avatar Feb 07 '19 08:02 sidntrivedi012

I experimented a bit with crossvent( now '.csv' links in markdown are automatically converted to '<div class="powertags">Power tag: graph:' + href.link + '</div>') but I still think we can go further and replace the injected HTML by some fancy characters like we did in AutoCenter with -> and <- so as to make this more readable and easily operable. How does that sound?

peek 2019-02-08 20-09

rexagod avatar Feb 08 '19 15:02 rexagod

That sounds great! Do you want to implement the quick fix and open an issue for a more advanced version, or what do you think?

Thanks so much for looking at this!

On Fri, Feb 8, 2019 at 10:58 AM Pranshu Srivastava [email protected] wrote:

I experimented a bit with crossvent( now '.csv' links in markdown are automatically converted to '

Power tag: graph:' + href.link + '
') but I still think we can go further and replace the injected HTML by some fancy characters like we did in AutoCenter with -> and <- so as to make this more readable and easily operable. How does that sound?

[image: peek 2019-02-08 20-09] https://user-images.githubusercontent.com/33557095/52489157-875d7700-2be7-11e9-96cd-c7c00b34ce7f.gif

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/PublicLab.Editor/issues/142#issuecomment-461850012, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJxUNs7qU2pWbkEpHDD7m-BSxOL1Uks5vLZ5tgaJpZM4Tvc1R .

jywarren avatar Feb 08 '19 16:02 jywarren