Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions app/javascript/components/editor-config/citations.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { saRequest } from '../../utils/saRequest'
import parse from 'html-react-parser'
import classnames from 'classnames'
import { store } from '../../store'
import {v4 as uuidv4} from 'uuid'

export const citationPluginKey = new PluginKey('citations')

Expand Down Expand Up @@ -102,7 +103,7 @@ export const addCitation = function (state, dispatch, view) {
var { currentUser, currentPost } = store.getState()

const newCitation = new Citation(
randomID(),
uuidv4(),
payload.value,
highlightedText,
payload.url
Expand Down Expand Up @@ -150,7 +151,7 @@ export const addCitation = function (state, dispatch, view) {
})
p.then((result) => {
const newCitation = new Citation(
randomID(),
uuidv4(),
payload.value,
highlightedText,
result.body.post.slug
Expand Down Expand Up @@ -244,10 +245,6 @@ export const citationPlugin = new Plugin({
},
})

function randomID() {
return Math.floor(Math.random() * 0xffffffff)
}

export const citationUI = function (transaction) {
return new Plugin({
props: {
Expand Down