josdejong / jsoneditor

A web-based tool to view, edit, format, and validate JSON
http://jsoneditoronline.org
Apache License 2.0
11.23k stars 2.02k forks source link

Implement an option to enable/disable date tags #1553

Open tormozit opened 8 months ago

tormozit commented 8 months ago
  1. ОК { "test": 123456789012 } изображение

  2. Not OK - extra date appeared { "test": 1234567890123 } изображение

josdejong commented 8 months ago

The editor uses some heuristics to determine whether a value contains a unix timestamp, and in that case displays a tag showing the date. Similarly, it interprets when a values is a color and then shows a colorpicker.

If you don't want the date tag, you can hide it via CSS.

Do you actually have with real world data with numbers in this range?

tormozit commented 8 months ago

I think many users will be happy to have an option to turn off the heuristics. I agree they are usefull but not all the time. My case - user was confused by strange data in tree mode. And he created bug-ticket for me.

josdejong commented 8 months ago

Makes sense to implement a configuration option for this. And we should probably create an option for the color picker too.

Anyone interested in implementing this option? Help would be welcome.

tormozit commented 8 months ago

For my taste gray color is optimal for most cases. Current blue is too saturated. editor.menu.style.backgroundColor = "#d0d0d0";

I turned off unwanted date heuristics here

 if (this._showTimestampTag()) {
          if (!this.dom.date) { 
            return // FIX
            this.dom.date = document.createElement('div');
            this.dom.date.className = 'jsoneditor-date';
            this.dom.value.parentNode.appendChild(this.dom.date);
          }