Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import AceEditor from 'react-ace';
import 'brace/mode/markdown';
import 'brace/theme/tomorrow_night';
import SplitPane from 'react-split-pane';
import Y from 'yjs/dist/y.es6';
import yArray from 'y-array/dist/y-array.es6';
import yWebsocketsClient from 'y-websockets-client/dist/y-websockets-client.es6';
import yMemory from 'y-memory/dist/y-memory.es6';
import yText from 'y-text/dist/y-text.es6';
import verge from 'verge';
import WikiParser from './WikiParser';
Y.extend(yArray, yWebsocketsClient, yMemory, yText);
const aceRequire = brace.acequire;
const resizerMargin = 12;
export default class AppEnabledWikiEditorAce extends React.Component {
constructor(props) {
super();
this.state = { text: props.defaultValue, hast: WikiParser.convertToCustomHast(WikiParser.parseToHast(props.defaultValue)), editorPercentage: 50 };
this.handleResize = this.updateSize.bind(this);
this.handleSplitResized = this.handleSplitResized.bind(this);
this.handleEdit = this.handleEdit.bind(this);
this.handleAppEdit = this.handleAppEdit.bind(this);
this.AceRange = aceRequire('ace/range').Range;
}
componentWillMount() {
import 'codemirror/mode/markdown/markdown';
import SplitPane from 'react-split-pane';
import io from 'socket.io-client';
import ColorConvert from 'color-convert';
import Y from 'yjs/dist/y.es6';
import yArray from 'y-array/dist/y-array.es6';
import yWebsocketsClient from 'y-websockets-client/dist/y-websockets-client.es6';
import yMemory from 'y-memory/dist/y-memory.es6';
import yText from 'y-text/dist/y-text.es6';
import actual from 'actual';
import WikiParser from './WikiParser';
Y.extend(yArray, yWebsocketsClient, yMemory, yText);
const resizerMargin = 12;
class OtherClientCursor {
constructor(id) {
this.id = id;
let hue = 0;
for (let i = 0; i < id.length; i += 1) {
hue *= 2;
hue += id.charCodeAt(i);
hue %= 360;
}
this.color = `#${ColorConvert.hsv.hex(hue, 100, 100)}`;
}
updateCursor(cursorPos, cm) {