@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
23 lines • 811 B
JavaScript
import { productionLinkPreferencesUrl, stagingLinkPreferencesUrl } from './constants';
export function isTextAtPos(pos) {
return state => {
const node = state.doc.nodeAt(pos);
return !!node && node.isText;
};
}
export function isLinkAtPos(pos) {
return state => {
const node = state.doc.nodeAt(pos);
return !!node && !!state.schema.marks.link.isInSet(node.marks);
};
}
export const getLinkPreferencesURLFromENV = () => {
if (process.env.NODE_ENV === 'production' && process.env.CLOUD_ENV === 'staging') {
// only a production CLOUD_ENV staging environment has a different link preferences URL
return stagingLinkPreferencesUrl;
} else if (process.env.NODE_ENV === 'production') {
return productionLinkPreferencesUrl;
} else {
return stagingLinkPreferencesUrl;
}
};