Просмотр исходного кода

fix: expand placeholders when DOM selection is empty (FF)

tophf 5 лет назад
Родитель
Сommit
b75f737991
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      src/common/ui/code.vue

+ 2 - 2
src/common/ui/code.vue

@@ -474,8 +474,8 @@ export default {
     onCopy(e) {
       // CM already prepared the correct text in DOM selection, which is particularly
       // important when using its lineWiseCopyCut option (on by default)
-      const sel = `${window.getSelection()}`;
-      if (!this.cm || !sel) return;
+      const sel = `${window.getSelection()}` || this.cm?.getSelection();
+      if (!sel) return;
       const text = this.getRealContent(sel);
       e.clipboardData.setData('text', text);
       e.preventDefault();