2ik / django-editorjs-fields

Django plugin for using Editor.js
MIT License
133 stars 33 forks source link

Tunes on image block are discarded #29

Closed brtchkv closed 2 years ago

brtchkv commented 2 years ago

Faced very weird bug, when I add tune blockAlignment to the Image tool, it gets displayed only once shortly after the redeploy. Then it is gone until next redeploy is done. I tried to clean cache, open window in different browsers, in private modes -- nothing helps.

It is visible only once (and present in html) and then it's gone till the platform is restarted. Seems to be some issue with adding Tunes blocks to Image in particular, since on any other block it works well.

In browser console logs there's no errors. And in backend logs -- too.

  plugins = [ '@editorjs/image', 'editorjs-text-alignment-blocktune' ],
  tools = {
            'Image': {
                  'class': 'ImageTool',
                  'tunes': ['blockAlignment'],
                  'inlineToolbar': True,
                  "config": {
                      "endpoints": {
                          "byFile": reverse_lazy('editorjs_image_upload'),
                          "byUrl": reverse_lazy('editorjs_image_by_url')
                      }
                  },
              },
            'blockAlignment': {
                  'class': 'AlignmentBlockTune',
                  'config': {
                      'default': "left",
                      'blocks': {
                          'header': 'left',
                          'list': 'left',
                          'Image': 'center'
                      }
                  },
              }
         }           

First view:

image

Any other view in any condition (user switch, cache clean, different browser):

image

Same alignment block on any other block for example Paragraph:

image
brtchkv commented 2 years ago

Hi, @2ik, sorry to bother, but can you give estimation if this will be fixed soon (till mid-January). Or, I can fork and fix it on my own or maybe try another image block component with hard coded tunes?

2ik commented 2 years ago

Hi, I can't find the time to work on it yet Has testing been done on pure html + js (without Django) ? Where can be errors in django-editorjs-fields?

I'm always happy new PR ;)

brtchkv commented 2 years ago

Hi, @2ik, I ended up forking editor js image component and hard-coding in it the tunes I needed :)

About pure html and js, I tried. but got somewhere stuck and decided that just forking original component and rewrite it a bit for myself would be faster and less painful )0))

And s nastupayushhim novy`m godom! 🎅 ❄️