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

Fix escaping {{ TrackLink }} in WYSIWYG editor UI

Kailash Nadh 4 лет назад
Родитель
Сommit
7a9d11d426
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      frontend/src/components/Editor.vue

+ 5 - 0
frontend/src/components/Editor.vue

@@ -84,6 +84,11 @@ const quillFontSizes = Quill.import('attributors/style/size');
 quillFontSizes.whitelist = ['11px', '13px', '22px', '32px'];
 Quill.register(quillFontSizes, true);
 
+// Sanitize {{ TrackLink "xxx" }} quotes to backticks.
+const regLink = new RegExp(/{{(\s+)?TrackLink(\s+)?"(.+?)"(\s+)?}}/);
+const Link = Quill.import('formats/link');
+Link.sanitize = (l) => l.replace(regLink, '{{ TrackLink `$3`}}');
+
 // Custom class to override the default indent behaviour to get inline CSS
 // style instead of classes.
 class IndentAttributor extends Quill.import('parchment').Attributor.Style {