Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/content_editor/services/utils.js')
-rw-r--r--app/assets/javascripts/content_editor/services/utils.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/assets/javascripts/content_editor/services/utils.js b/app/assets/javascripts/content_editor/services/utils.js
index 1c128b4aa19..391d3b1a665 100644
--- a/app/assets/javascripts/content_editor/services/utils.js
+++ b/app/assets/javascripts/content_editor/services/utils.js
@@ -1,3 +1,6 @@
+import axios from 'axios';
+import { memoize } from 'lodash';
+
export const hasSelection = (tiptapEditor) => {
const { from, to } = tiptapEditor.state.selection;
@@ -5,3 +8,8 @@ export const hasSelection = (tiptapEditor) => {
};
export const clamp = (n, min, max) => Math.max(Math.min(n, max), min);
+
+export const memoizedGet = memoize(async (path) => {
+ const { data } = await axios(path, { responseType: 'blob' });
+ return data.text();
+});