Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 84x 710x 15x 695x 695x 710x 102x 84x 95x 95x 95x 84x 411x 411x 84x 6x 6x 84x 102x 102x 102x 1x 84x 76x 84x 76x | import { isString } from 'lodash'; import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; const normalizeKey = (autosaveKey) => { let normalizedKey; if (Array.isArray(autosaveKey) && autosaveKey.every(isString)) { normalizedKey = autosaveKey.join('/'); } else if (isString(autosaveKey)) { normalizedKey = autosaveKey; } else E{ // eslint-disable-next-line @gitlab/require-i18n-strings throw new Error('Invalid autosave key'); } return `autosave/${normalizedKey}`; }; const lockVersionKey = (autosaveKey) => `${normalizeKey(autosaveKey)}/lockVersion`; export const clearDraft = (autosaveKey) => { try { window.localStorage.removeItem(normalizeKey(autosaveKey)); window.localStorage.removeItem(lockVersionKey(autosaveKey)); } catch (e) { // eslint-disable-next-line no-console console.error(e); } }; export const getDraft = (autosaveKey) => { try { return window.localStorage.getItem(normalizeKey(autosaveKey)); } catch (e) { // eslint-disable-next-line no-console console.error(e); return null; } }; export const getLockVersion = (autosaveKey) => { try { return window.localStorage.getItem(lockVersionKey(autosaveKey)); } catch (e) { // eslint-disable-next-line no-console console.error(e); return null; } }; export const updateDraft = (autosaveKey, text, lockVersion) => { try { window.localStorage.setItem(normalizeKey(autosaveKey), text); if (lockVersion) { window.localStorage.setItem(lockVersionKey(autosaveKey), lockVersion); } } catch (e) { // eslint-disable-next-line no-console console.error(e); } }; export const getDiscussionReplyKey = (noteableType, discussionId) => /* eslint-disable-next-line @gitlab/require-i18n-strings */ ['Note', capitalizeFirstCharacter(noteableType), discussionId, 'Reply'].join('/'); export const getAutoSaveKeyFromDiscussion = (discussion) => getDiscussionReplyKey(discussion.notes.slice(0, 1)[0].noteable_type, discussion.id); |