audreyt / ethercalc

Node.js port of Multi-user SocialCalc
https://ethercalc.net
Other
2.96k stars 534 forks source link

Force text interpretation / turn off number parsing #527

Open amir-zeldes opened 7 years ago

amir-zeldes commented 7 years ago

Is there a way to prevent EtherCalc from parsing anything as a date/number etc.?

I'm basically looking for a global way to make any entered content in a running instance, including pastes from the clipboard, behave like text. I know that users can prefix cell contents with ' to cause this behavior, but ideally I'd like them to be able to type anything in and have it stay the same way they typed it, and with pasting it's particularly important not to require the apostrophe.

amir-zeldes commented 7 years ago

OK, I've figured out that I can preempt the format interpretation here:

https://github.com/marcelklehr/socialcalc/blob/master/socialcalc-3.js#L5904

The function DetermineValueType just has to return instantly without checking anything. I can edit the code that way for my own instance, but it would be overwritten whenever I update EtherCalc.

If this would be a useful option for other users (and I can imagine all sorts of use cases), what would be the best way to introduce some sort of configuration option to the installation that triggers this behavior?

Or maybe even better, a spreadsheet setting that specifies this behavior just for a specific room, something like a 'treat everything as text' flag.

derpeter commented 7 years ago

I have the same problem. I'm wondering why setting the format to cell still results in an output thats interprets the cell. E.g. a cell holding a time 00:30 ends up in the CSV as an float number.

eddyparkinson commented 7 years ago

You can use a single quote

'0:30

rather than 0:30

amir-zeldes commented 7 years ago

Hi @eddyparkinson, my main issue with using single quotes is the behavior on paste - I want to make sure that plain text pasting is always treated as text. Editing the position in the link above takes care of that, but it might be nice to make this behavior configurable for either individual sheets or the whole installation.

eddyparkinson commented 7 years ago

Paste as text @amir-zeldes sound like you want an extra pasting option, so it will paste as plain text. I.e. auto add the single quote.

I can mark as a feature request.

derpeter commented 7 years ago

@eddyparkinson that the only way i found. But its quite annoying to do that for many cells. I dont get why the default is to alter the data in the tables. I can some how understand that people would want there date nicely printed in the browser. I would vote for an option to activate that. But why it is altered in the export and also the browser presents it altered by default is strange to me.

derpeter commented 7 years ago

@eddyparkinson special past option would be a step in the right direction but for typing into the calc its still not helping. A format or a setting to not interpret data at all in a range of cells or the whole document would be awesome.

amir-zeldes commented 7 years ago

I agree that a special paste option would probably make sense for a lot of people, though like @derpeter, for my own purposes too, turning off any non-plain text interpretation completely would be best, since I otherwise have to catch and escape it anyway if someone forgets a single quote.

Currently I just edited socialcalc-3.js and hard-wired this behavior, but it would be nice to have a configuration to do that which survives version upgrades.