Skip to main content

New lines inserted during saving

When saving, sometimes lines are broken up by having a portion of the code separated by a new line character and moving it to a new line. If I attempt to fix this by restoring the original text so it’s easier to read, it again gets broken up into multiple lines when saving.

For instance, this:

add_action("admin_init", function () {
  add_editor_style(
    "data:text/css," . rawurlencode('
        body#tinymce a { color: var(--color-primary); }
        body#tinymce { background: none !important; color: #fff !important; font-family: "Nunito Sans", sans-serif; font-size: 16px; }
        body#tinymce p { color: #fff; }
    ')
  );
}); 

is transformed to this when saved:

add_action("admin_init", function () {
  add_editor_style(
    "data:text/css," .
      rawurlencode('
        body#tinymce a { color: var(--color-primary); }
        body#tinymce { background: none !important; color: #fff !important; font-family: "Nunito Sans", sans-serif; font-size: 16px; }
        body#tinymce p { color: #fff; }
    ')
  );
});

Another example—this:

.login input[type="checkbox"], .login input[type="password"], .login input[type="text"] {
  -webkit-box-shadow: none;
  box-shadow: none;
}

is transformed into this when saved:

.login input[type="checkbox"],
.login input[type="password"],
.login input[type="text"] {
  -webkit-box-shadow: none;
  box-shadow: none;
}


How do I stop this madness?

Status: Completed1 comment

Log in to comment and vote

Comments1

  • mark@uipress.co

    Team•

    Mar 27

    This is the auto format on save. I will add options to control this behaviour