editor.js icon indicating copy to clipboard operation
editor.js copied to clipboard

Select and Convert multiple blocks to one blockšŸ’”

Open evanjmg opened this issue 4 years ago • 7 comments

Feature: I have a bunch paragraphs I'd like to arrange into a list.

Behaviour: Select multiple blocks, click, and the conversion tool appears and I can make a conversion into one block. Conversion config would need to have a new field on how to merge multiple blocks.

Are there any alternatives? It's very tedious to create and modify lists from existing content. The only alternative is to backspace all paragraphs into one paragraph and then convert to list - which isn't intuitive.

evanjmg avatar Mar 30 '21 09:03 evanjmg

I'll try to create a pr on this soon.

evanjmg avatar Mar 30 '21 09:03 evanjmg

^ PR above, let me know if you have any feedback

evanjmg avatar Mar 31 '21 18:03 evanjmg

Additional configuration will be added to header and nested list libraries:

// list mergeImport
   mergeImport: (arr: string[]) => {
        return {
          items: arr.map((content) => {
            return {
              content,
              items: [],
            };
          }),
        };
      }
// header mergeImport 
 mergeImport: (data: string[], blocks) => {
        const { level } = blocks[0];
        const text = data.join(' ');
        const hasSameHeading = level && blocks.every((block) => level === block.level);
        if (hasSameHeading) {
          return {
            text,
            level,
          };
        }

        return {
          text,
        };
      },

evanjmg avatar Mar 31 '21 19:03 evanjmg

Nice feature, and something I am after.

zizther avatar Apr 04 '21 21:04 zizther

This is one of the biggest thing that's missing in this Editor. Thanks for opening this!

hcherchi avatar Sep 29 '21 14:09 hcherchi

Hi, this is also the biggest thing I'm missing in EditorJS.

Is there any update on this feature?

camya avatar Oct 10 '22 08:10 camya

This feature is needed I'm sure by many! Any update on this in future releases?

jackcooke avatar Nov 22 '23 12:11 jackcooke