guardian / scribe-plugin-curly-quotes

5 stars 5 forks source link

Errors when entering quotes in non-P container #8

Open theefer opened 10 years ago

theefer commented 10 years ago

this line throws the following error if typing a quote character in a text node that has no P container:

TypeError: Cannot read property 'innerHTML' of undefined

Looks like we should be trying to find any kind of block-level container instead.

OliverJAsh commented 10 years ago

Ahh. This just means quotes won't be converted, right?

Does it also mean all subsequent formatters will not be ran?

On Tuesday, July 29, 2014, Sébastien Cevey notifications@github.com wrote:

this line https://github.com/guardian/scribe-plugin-curly-quotes/blob/master/src/scribe-plugin-curly-quotes.js#L42 throws the following error if typing a quote character in a text node that has no P container:

TypeError: Cannot read property 'innerHTML' of undefined

Looks like we should be trying to find any kind of block-level container instead.

— Reply to this email directly or view it on GitHub https://github.com/guardian/scribe-plugin-curly-quotes/issues/8.

Oliver Joseph Ash Software Engineer


Visit theguardian.com. On your mobile and tablet, download the Guardian iPhone and Android apps theguardian.com/guardianapp and our tablet editions theguardian.com/editions. Save up to 57% by subscribing to the Guardian and Observer - choose the papers you want and get full digital access. Visit subscribe.theguardian.com

This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way. Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software.

Guardian News & Media Limited is a member of Guardian Media Group plc. Registered Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP. Registered in England Number 908396

theefer commented 10 years ago

Ahh. This just means quotes won't be converted, right?

Yes, I've been able to reproduce it.

Does it also mean all subsequent formatters will not be ran?

Actually this error only happens on input when typing a quote, so no other formatter would have run. Not sure what happens when the code placed marker but the throw exception never selected them?

OliverJAsh commented 10 years ago

The markers would be selected at the end of the next transaction, but I'm not sure how that would be dealt with.

It might be wise to wrap each formatter in a try-catch, just so that if we do ever break a formatter, it won't stop the reduce from continuing. Thoughts? I realise this plugin is outside of the formatter scope.

On Tuesday, July 29, 2014, Sébastien Cevey notifications@github.com wrote:

Ahh. This just means quotes won't be converted, right?

Yes, I've been able to reproduce it.

Does it also mean all subsequent formatters will not be ran?

Actually this error only happens on input when typing a quote, so no other formatter would have run. Not sure what happens when the code placed marker but the throw exception never selected them?

— Reply to this email directly or view it on GitHub https://github.com/guardian/scribe-plugin-curly-quotes/issues/8#issuecomment-50504423 .

Oliver Joseph Ash Software Engineer


Visit theguardian.com. On your mobile and tablet, download the Guardian iPhone and Android apps theguardian.com/guardianapp and our tablet editions theguardian.com/editions. Save up to 57% by subscribing to the Guardian and Observer - choose the papers you want and get full digital access. Visit subscribe.theguardian.com

This e-mail and all attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender and delete the e-mail and all attachments immediately. Do not disclose the contents to another person. You may not use the information for any purpose, or store, or copy, it in any way. Guardian News & Media Limited is not liable for any computer viruses or other material transmitted with or as part of this e-mail. You should employ virus checking software.

Guardian News & Media Limited is a member of Guardian Media Group plc. Registered Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP. Registered in England Number 908396

theefer commented 10 years ago

Again this is not part of a formatter function, it's in the input handler itself. It's really just a bug.

try-catching formatters -- yes we could do, or at least we should guarantee that if errors are thrown the behaviour is what we expect, but that's unrelated to this issue.

theefer commented 10 years ago

Note: can also be an apostrophe in an H2.

OliverJAsh commented 10 years ago

See https://github.com/guardian/scribe-plugin-curly-quotes/pull/9