Skip to content
Snippets Groups Projects
Commit 52a699c0 authored by David Bühler's avatar David Bühler
Browse files

[ivette] WIP: code mirror editors use directly the buffer internal document.

Instead of creating a new linked document. Temporary fix to access the instance
of code mirror from the buffer.
parent 2b7c2f71
No related branches found
No related tags found
No related merge requests found
...@@ -112,7 +112,7 @@ export class Text extends React.Component { ...@@ -112,7 +112,7 @@ export class Text extends React.Component {
className, /* ignored */ className, /* ignored */
style, /* ignored */ style, /* ignored */
...config } = this.props ; ...config } = this.props ;
const value = buffer ? buffer.linkedDoc() : "" ; const value = buffer ? buffer.getDoc() : "" ;
const cm = this.codeMirror = new CodeMirror(elt, { value }); const cm = this.codeMirror = new CodeMirror(elt, { value });
// Passing all options to constructor does not work (Cf. CodeMirror's BTS) // Passing all options to constructor does not work (Cf. CodeMirror's BTS)
for (var opt in config) cm.setOption( opt , config[opt] ); for (var opt in config) cm.setOption( opt , config[opt] );
...@@ -343,7 +343,7 @@ export class Text extends React.Component { ...@@ -343,7 +343,7 @@ export class Text extends React.Component {
selection:newSelect, selection:newSelect,
...newConfig } = newProps ; ...newConfig } = newProps ;
if (oldBuffer !== newBuffer) { if (oldBuffer !== newBuffer) {
const newDoc = newBuffer.linkedDoc(); const newDoc = newBuffer.getDoc();
const oldDoc = cm.swapDoc( newDoc ); const oldDoc = cm.swapDoc( newDoc );
oldBuffer.unlinkDoc( oldDoc ); oldBuffer.unlinkDoc( oldDoc );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment