Left-to-right view mod in new workflow editor

Now featured in the Codeless Love Bubble Editor Powerup chrome extension!

One of the biggest issues I and others dislike about the new workflow editor is the vertically stacked actions - This causes us to lose a lot of screen real estate and adds the need to scroll through large workflows.

I’m sharing a script I am going to be using for the foreseeable future that tweaks the layout from a vertical stacked layout to a horizontal one.

Before:

After:

Copy and paste this into the console in your developer tools

function initialize() {
    console.log("❤️ Initializing left-to-right workflow window feature");

    // Set up a MutationObserver to watch for action preview window
    const observer = new MutationObserver((mutations) => {
      const workflowWindow = document.querySelector('div[data-name="preview"] div[role="button"] + div');
      if (workflowWindow) {
        applyCustomStyles();
      }
    });

    // Find the action editor or wait for it
    const actionEditor = document.querySelector('.action-editor');
    if (actionEditor) {
      observer.observe(actionEditor, {
        childList: true,
        subtree: true
      });
    } else {
      // If action editor isn't available yet, watch for it to be added
      const parentObserver = new MutationObserver((mutations, observer) => {
        const actionEditor = document.querySelector('.action-editor');
        if (actionEditor) {
          observer.disconnect();
          // Start observing the action editor
          applyCustomStyles();
          console.log('❤️ Found action editor, left-to-right mode should be applied correctly now.')
          observer.observe(actionEditor, {
            childList: true,
            subtree: true
          });
        }
      });

      parentObserver.observe(document.body, {
        childList: true,
        subtree: true
      });
    }
  }

  // Wait for DOM to be ready
  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", initialize);
  } else {
    initialize();
  }


  function applyCustomStyles() {
    const target = document.querySelector('div[data-name="preview"] div[role="button"] + div');
  
    if (!target) return;
  
    target.style.setProperty('flex-direction', 'row', 'important');
    target.style.setProperty('flex-wrap', 'wrap', 'important');
    target.style.setProperty('align-items', 'stretch', 'important');
    target.style.setProperty('justify-content', 'start', 'important');
    target.style.setProperty('row-gap', '20px', 'important');
    target.style.setProperty('padding', '20px', 'important');
    target.style.setProperty('padding-bottom', '120px', 'important');
  
    const childElements = target.children;
    for (let i = 0; i < childElements.length; i++) {
      const child = childElements[i];
  
      if (!child.getAttribute("role")) {
        child.style.setProperty('align-items', 'stretch', 'important');
        let nestedChildren = Array.from(child.querySelectorAll('div, span'));
        for (let j = 0; j < nestedChildren.length; j++) {
          const nested = nestedChildren[j];
          if (nested.getAttribute("aria-label") === 'Drag handle'){
            nested.style.setProperty('align-self', 'center', 'important');
            nested.style.setProperty('max-height', '12px', 'important');
            continue;
          } 
  
          nested.style.setProperty('display', 'flex', 'important');
          nested.style.setProperty('height', '100%', 'important');
          nested.style.setProperty('align-items', 'stretch', 'important');
  
          if (nested.style.position === 'absolute' && nested.style.top === '4px') {
            nested.style.setProperty('position', 'relative', 'important');
          }

          if (nested.tagName === 'SPAN' && nested.classList.contains('_1ox6jxm6')) {
            const item1 = nested.children[0]?.children[1];
            const item2 = nested.children[0]?.children[2];
          
            if (item1 && item2) {
              const newItems1 = Array.from(item1.querySelectorAll('div'));
              const newItems2 = Array.from(item2.querySelectorAll('div'));
              nestedChildren.splice(j + 1, 0, ...newItems1, ...newItems2);
            }
          }
  
          if (nested.classList.contains('_5r6zug0')) {
            break;
          }
        }
      } else {
        child.style.setProperty('align-self', 'center', 'important');
        child.style.setProperty('rotate', '270deg', 'important');
        child.style.setProperty('margin', '15px', 'important');
      }
    }
  }
  
  const style = document.createElement('style');
  style.textContent = `
  ._1nfonn86._1lkv1fw9._1lkv1fwb._1ij2r33{
  margin-top: 10px !important;
  margin-bottom: 5px !important;
  }
  ._1nfonn86._1lkv1fw9._1lkv1fwd._1ij2r31{
  margin-top: 5px !important;
  }
`;
  document.head.appendChild(style);

  applyCustomStyles();

Now featured in the Codeless Love Bubble Editor Powerup chrome extension!

Note, this only works on the “Default” view, and not the compact mode.

27 Likes

wow :clap: :clap: :clap:

@brenton.strine Something for Powerup?

Brenton has made a Chrome extension free/opensource that bundles together useful tweaks like this

6 Likes

That’s a great idea, since the userscript tool I used was harder than it should have been to set up.

2 Likes

Thank you ! The vertical workflow editor is definitely horrible to use. I understand the want to evolve, but putting the workflow editor vertical is definitely something bubble should have not done.

Humans read left to right, Bubble devs have been reading left to right for years, so why ? Why ?

3 Likes

great improvement from the new workflow builder… if only bubble thought to add this as an option before forcing it live on all of us

4 Likes

Nice change. In fact I think this view can even have capabilities of branching etc for which we are being told that this redesign was needed.

For example, if there is a branch, we can have a choice if we want the flow from that point onwards to be vertical or horizontal.

I will disagree because this will show less step overall on horizontal view with branching VS vertical view where you areable to increase width (not height) to see more steps. Think about make. When you have a lot of routing, make will reduce size to show you more steps, but in the end, you need to zoom in to see details about actions.

But I agree that this view option need to be added to the new workflow layout. For me, it’s better VS compact mode. The only thing is that this view need to also show all conditions string.

1 Like

Love the initiative @tim12333!

1 Like

Nice work!

Now riddle me this… how is it some random dude on the forum has come up with the solution everyones been begging for in less than 24hrs from the confines of his bedroom, whilst Bubble themselves have sat on it for months and done…nothing?

8 Likes

Took the words right outa my mouth. Only that I would have said it in American English :wink:

You don’t get it dude, this view wouldn’t work with loops/branches which is coming out very soon in 2070, so we need to prepare the workflow editor for it starting from now.

8 Likes

Because @tim12333 is a boss. And I should know, because I hired him, and that was the easiest decision ever.

2 Likes

They’re also not at all mutually exclusive.

Yeah, this would be a great addition. @tim12333 can you add it and make a PR? Or anyone else who wants to feel free!

Some guidance: I think this would need to be injected into the “main world” and can’t run in the “isolated world”. Take a look at the documentation on that in this readme:

But the jist of it is that you’ll make a separate file for your “main world” script, and then push it from the “isolated world” to the “main world” from the feature script using:

    chrome.runtime.sendMessage({
        action: "injectScriptIntoMainWorld",
        jsFile: "features/feature_key_goes_here/example_script_that_must_execute_in_the_main_world.js"
    });
2 Likes

@brenton.strine Thanks this is perfect, I didn’t know this existed.

I just made a PR for it!

3 Likes

Awesome, I just merged it in.

It’s available for anyone to install from the GitHub repo now.

I also pushed it to the Chrome store so it should be up soon (can take a few days).

6 Likes

Great collab, everyone.

So now we’ve collectively accepted upon ourselves the role of implementing the entire iterative design lifecycle in addition to QA… :slight_smile:

2 Likes

Let’s open-source the whole sucker and be done with it :rofl:

2 Likes

Hahaha funny and sad at the same time!

Community so strong

3 Likes