From 2c2d849fa46d3bdb83a191564b399dfb963083f1 Mon Sep 17 00:00:00 2001 From: eight Date: Sun, 14 Oct 2018 16:20:14 +0800 Subject: [PATCH] Fix: drop unused getCode --- edit/sections-editor-section.js | 5 ----- edit/sections-editor.js | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/edit/sections-editor-section.js b/edit/sections-editor-section.js index 572fc6e0..f4b21cc9 100644 --- a/edit/sections-editor-section.js +++ b/edit/sections-editor-section.js @@ -121,7 +121,6 @@ function createSection({ el, cm, render, - getCode, getModel, remove, destroy, @@ -265,10 +264,6 @@ function createSection({ showHelp(t('appliesLabel'), t('appliesHelp')); } - function getCode() { - return cm.getValue(); - } - function remove() { linter.disableForEditor(cm); el.classList.add('removed'); diff --git a/edit/sections-editor.js b/edit/sections-editor.js index 1fae9a07..96df2e83 100644 --- a/edit/sections-editor.js +++ b/edit/sections-editor.js @@ -485,7 +485,7 @@ function createSectionsEditor(style) { if (sections.every(s => s.isRemoved() || s === section)) { throw new Error('Cannot remove last section'); } - if (!section.getCode()) { + if (section.cm.isBlank()) { const index = sections.indexOf(section); sections.splice(index, 1); section.el.remove();