Fix: styleCodeEmpty returns true for empty string
This commit is contained in:
parent
89f836c003
commit
0b4d12a71f
|
@ -118,7 +118,6 @@ function createSectionsEditor(style) {
|
||||||
nearbyElement instanceof Node &&
|
nearbyElement instanceof Node &&
|
||||||
(nearbyElement.closest('#sections > .section') || {}).CodeMirror ||
|
(nearbyElement.closest('#sections > .section') || {}).CodeMirror ||
|
||||||
getLastActivatedEditor();
|
getLastActivatedEditor();
|
||||||
console.log(cm);
|
|
||||||
if (nearbyElement instanceof Node && cm) {
|
if (nearbyElement instanceof Node && cm) {
|
||||||
const {left, top} = nearbyElement.getBoundingClientRect();
|
const {left, top} = nearbyElement.getBoundingClientRect();
|
||||||
const bounds = cm.display.wrapper.getBoundingClientRect();
|
const bounds = cm.display.wrapper.getBoundingClientRect();
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function styleCodeEmpty(code) {
|
function styleCodeEmpty(code) {
|
||||||
|
if (!code) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const rx = /\s+|\/\*[\s\S]*?\*\/|@namespace[^;]+;|@charset[^;]+;/giy;
|
const rx = /\s+|\/\*[\s\S]*?\*\/|@namespace[^;]+;|@charset[^;]+;/giy;
|
||||||
while (rx.exec(code)) {
|
while (rx.exec(code)) {
|
||||||
if (rx.lastIndex === code.length) {
|
if (rx.lastIndex === code.length) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user