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

utils.js « services « content_editor « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 391d3b1a665b10d14985989144624f7f1993747c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import axios from 'axios';
import { memoize } from 'lodash';

export const hasSelection = (tiptapEditor) => {
  const { from, to } = tiptapEditor.state.selection;

  return from < to;
};

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();
});