InsertText not respecting Smart Quotes/Dashes setting?

Hi there,

I’ve disabled the Smart Quotes and Smart Dashes autocorrect options for the Markdown syntax in Drafts, because they affect YAML front matter. This is fine in the editor itself, but when I run an Action including an insertText script step, the inserted text seems to nevertheless be processed by the Smart Quotes and Smart Dashes replacement system.

A trivial example follows. First, ensure that Smart Quotes and Smart Dashes are disabled in Drafts’ settings for the current syntax. Then, create an Action with an Insert Text script step, which inserts the following text:

---
title: "[[title]]"
---

When the Action is run (at least on my machine), the text inserted into the frontmost draft will have smart/curly quotes, and the triple-dashes will each become an em-dash plus a regular dash.

My feeling is that, if the user has disabled Smart Quotes and Smart Dashes, this should be respected for all incoming text regardless of its provenance.

Fun. UITextView is pretty proud of its “smart” features even when you’ve disabled them. I believe I had to workaround a similar issue pasting text a while back…will take a look.

2 Likes

Similar issue here - I use “Insert Text” to format .csv output which requires some straight quotes. However, in spite of using a Plain Text draft with Smart Quotes DISABLED, my straight quotes are returned as Smart Quotes, which plays havoc when I import .csv file into Excel. My current workflow therefore requires a Search/Replace before I export.

I have also tried to use the Straight Quotes Action to do the conversion, without success.

Any ideas out there?

Thanks in advance,
David

Could you provide an example action demonstrating what you are doing? “Insert Text” is really intended only for use as the type of function that inserts text in the editor - like a key that inserts a date.

You may be running into a bug, and I’d like to see that in action, but it’s also likely it’s not a good way to prepare text for output manipulating it in the editor and there might be a better/more reliable way.

Wow - thanks for the quick response! I am not used to that kind of support from other developers!!

OK - in the process of documenting my “issue”, I realized it was my mistake after all (sorry about that) - one of the first INSERT TEXT actions I created, inadvertently inserted literal smart quotes (not sure how to even enter those, but at that point, I was probably still using markdown mode instead of plain text and didn’t have smart quote conversion disabled, so maybe that is why smart quotes were entered?). Anyway, I now changed the smart quote literals to straight quote literals and all is good now.

I am new to Drafts and it has been awhile since I did any coding, so I would like to briefly explain how I am using the INSERT TEXT action to see if you think it is an inappropriate use or if there is a better way to do it.

The use case is a front-end data capture for a Time Tracking application I have setup in Airtable (the eventual goal is to update directly into Airtable, but not until I get this method down first). At the end of a day I export a .csv file from Drafts and then use Excel to reformat the data for import into Airtable. I really want to optimize this process first, because I have several other use cases that don’t end up in Airtable. I have included below a screen shot with a bunch of scribbling, but the basics are as follows:

In the Action Bar, I have several actions to assist in entering time and details:

NewDay - creates new draft, assigns “time” tag, involks another action that uses TextExpander to create the top two lines (Title and Date Stamp) and the 3rd line, which is the first entry for the day

Start - creates a new time entry (Time Stamp, [], “”") - note the trailing double quotes, which will wrap the 3rd DESCRIPTION field to allow special characters without interfering with the comma delimiters

CC-TXT - insert any of several activity types within the preceding square brackets (these ultimately create a multiselect array field in Airtable (EmailFrom, TelconTo, LeftMessage, etc)

Mic - allows for dictating the Description field, which I mostly use remotely with my iPhone; if in the office, I use my iPad with the Magic Keyboard (pretty awesome)

End - inserts the closing double quotes, final comma and ending time stamp

Dropbox - exports the draft to Dropbox

Last, if it would be helpful to upload my ActionGroup, I would be glad to do that, but not quite sure how to do that at this point.

My apologies for the long post, but thanks in advance for any insight you might offer.

Best Regards,
David