Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch PreviewView to extend EditorView #32

Closed
Glavin001 opened this issue Jul 28, 2014 · 20 comments · Fixed by #45
Closed

Switch PreviewView to extend EditorView #32

Glavin001 opened this issue Jul 28, 2014 · 20 comments · Fixed by #45

Comments

@Glavin001
Copy link
Owner

This will fix issues #31 (line numbers), #25 (font-size syncing), and #27 (theme applying), #20 (saving preview).

@ddavison
Copy link
Collaborator

@Glavin001 Did you get my message on gitter?

@Glavin001
Copy link
Owner Author

Oh, I see it now. Sorry I just got home and had not even opened up Gitter yet.

@Glavin001
Copy link
Owner Author

@ddavison be sure to check out: https://atom.io/docs/api/v0.120.0/api/

And https://github.com/atom/atom/search?q=new+Editor&ref=cmdform

I see spec/editor-view-spec.coffee uses:

 @editor ?= new Editor
        buffer: new TextBuffer
        softWrap: false

We need a TextBuffer, then get Editor, then EditorView.

PreviewView extends EditorView then override the constructor to call super(editor: editor) where the editor has just been created (see above) if not already created (singleton pattern?), and then we manipulate it (which I think actuallys saves to the TextBuffer, but the EditorView appears to have setText function.

We should actually have a VERY small (in comparison) PreviewView source code 😃

@ddavison
Copy link
Collaborator

I'm not having to much luck with this one. Since this issue fixes multiple issues, it's priority is pretty high, and I can't dedicate too much time to it, i'll assign it back to you. I'll tackle another

@ddavison ddavison assigned Glavin001 and unassigned ddavison Jul 29, 2014
@Glavin001
Copy link
Owner Author

No worries, @ddavison. I'll take a shot at it and see how it goes.

@ddavison
Copy link
Collaborator

i can push my dev branch that i was on if you'd like.

@Glavin001
Copy link
Owner Author

Sure, that'd be great! Thanks.

How far did you get?

@ddavison
Copy link
Collaborator

fix-32 branch.. still hadn't gotten it to work

This was referenced Aug 8, 2014
@Glavin001
Copy link
Owner Author

See atom/atom@fb4361e
@nathansobo is currently guarding access to the ReactEditorView. The ReactEditorView is required, as using the EditorView did not work.

@Glavin001
Copy link
Owner Author

Got it working!
image

@Glavin001
Copy link
Owner Author

This also means that any packages that apply to the EditorView (think linting, color highlighting, mini-map, and more) will also be applied to the Preview view!

@Glavin001
Copy link
Owner Author

For instance:
image

Update: I am unable to get the mini-map working, but that is an issue for another day.

@Glavin001
Copy link
Owner Author

  • Implement with PreviewView extending ReactEditorView
    • Use the EditorView to render with the given Grammar and source code text
  • Apply the correct source code renderer and display the resulting source code in the new preview view
  • re-implement debouncing
  • enhance content to support more elements

@Glavin001
Copy link
Owner Author

Saving ( #20 ) does not yet work. May need some help from @kevinsawicki (or other Atom developer familiar with how I can trigger opening the File Dialog popup to save the EditorView) on this one.

Glavin001 added a commit that referenced this issue Aug 9, 2014
Closes #31. Shows line numbers.
Fixes #25. Font-size syncing (automatically by EditorView).
Fixes #27. Theme syncing (automatically by EditorView).
Fixes #44. Exceptions and crashes should no longer be an issue.
@Glavin001
Copy link
Owner Author

I had manually copied the Atom's node_modules/ directory (since I was working offline and needed some dependencies). Now that I have cleared the directory and am adding the required dependencies to the package.json file I am receiving the following error when I run apm install:

atom-preview$ apm install
Installing modules ✗
> [email protected] install /Users/glavin/Documents/Project_Dev/atom-preview/node_modules/pathwatcher
> node-gyp rebuild

  CXX(target) Release/obj.target/pathwatcher/src/main.o

2014-08-09 22:33:09.065 xcodebuild[97272:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XToDo.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-08-09 22:33:09.067 xcodebuild[97272:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XAlign.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-08-09 22:33:09.068 xcodebuild[97272:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/SCXcodeMinimap.xcplugin' not present in DVTPlugInCompatibilityUUIDs
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:342:74: error: too many arguments to function call, expected at most 3, have 4
    return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
           ~~~~~~~~~~~~~~~~~~                                            ^~~~
/Users/glavin/.atom/.node-gyp/.node-gyp/0.11.10/deps/v8/include/v8.h:3550:3: note: 'New' declared here
  static Local<Signature> New(Handle<FunctionTemplate> receiver =
  ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:370:27: error: cannot initialize a parameter of type 'int' with an rvalue of type 'v8::Isolate *'
    return v8::Array::New(v8::Isolate::GetCurrent());
                          ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/glavin/.atom/.node-gyp/.node-gyp/0.11.10/deps/v8/include/v8.h:2307:31: note: passing argument to parameter 'length' here
  static Local<Array> New(int length = 0);
                              ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:375:54: error: too many arguments to function call, expected at most single argument 'length', have 2 arguments
    return v8::Array::New(v8::Isolate::GetCurrent(), length);
           ~~~~~~~~~~~~~~                            ^~~~~~
/Users/glavin/.atom/.node-gyp/.node-gyp/0.11.10/deps/v8/include/v8.h:2307:3: note: 'New' declared here
  static Local<Array> New(int length = 0);
  ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:380:53: error: too many arguments to function call, expected single argument 'time', have 2 arguments
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
           ~~~~~~~~~~~~~                            ^~~~
/Users/glavin/.atom/.node-gyp/.node-gyp/0.11.10/deps/v8/include/v8.h:2831:3: note: 'New' declared here
  static Local<Value> New(double time);
  ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:380:70: error: expected '(' for function-style cast or type construction
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
                                                             ~~~~~~~~^
../node_modules/nan/nan.h:380:72: error: expected expression
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
                                                                       ^
../node_modules/nan/nan.h:385:53: error: too many arguments to function call, expected single argument 'time', have 2 arguments
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
           ~~~~~~~~~~~~~                            ^~~~
/Users/glavin/.atom/.node-gyp/.node-gyp/0.11.10/deps/v8/include/v8.h:2831:3: note: 'New' declared here
  static Local<Value> New(double time);
  ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:385:70: error: expected '(' for function-style cast or type construction
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
                                                             ~~~~~~~~^
../node_modules/nan/nan.h:385:72: error: expected expression
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
                                                                       ^
../node_modules/nan/nan.h:388:15: error: no type named 'UnboundScript' in namespace 'v8'
  typedef v8::UnboundScript NanUnboundScript;
          ~~~~^
../node_modules/nan/nan.h:396:9: error: no member named 'ScriptCompiler' in namespace 'v8'
    v8::ScriptCompiler::Source source(s, origin);
    ~~~~^
../node_modules/nan/nan.h:397:16: error: no member named 'ScriptCompiler' in namespace 'v8'
    return v8::ScriptCompiler::CompileUnbound(
           ~~~~^
../node_modules/nan/nan.h:398:37: error: use of undeclared identifier 'source'; did you mean 'v8::Extension::source'?
        v8::Isolate::GetCurrent(), &source);
                                    ^~~~~~
                                    v8::Extension::source
/Users/glavin/.atom/.node-gyp/.node-gyp/0.11.10/deps/v8/include/v8.h:3677:46: note: 'v8::Extension::source' declared here
  const String::ExternalAsciiStringResource* source() const {
                                             ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:398:36: error: must explicitly qualify name of member function when taking its address
        v8::Isolate::GetCurrent(), &source);
                                   ^~~~~~~
                                    Extension::
../node_modules/nan/nan.h:405:9: error: no member named 'ScriptCompiler' in namespace 'v8'
    v8::ScriptCompiler::Source source(s);
    ~~~~^
../node_modules/nan/nan.h:406:16: error: no member named 'ScriptCompiler' in namespace 'v8'
    return v8::ScriptCompiler::CompileUnbound(
           ~~~~^
../node_modules/nan/nan.h:407:37: error: use of undeclared identifier 'source'; did you mean 'v8::Extension::source'?
        v8::Isolate::GetCurrent(), &source);
                                    ^~~~~~
                                    v8::Extension::source
/Users/glavin/.atom/.node-gyp/.node-gyp/0.11.10/deps/v8/include/v8.h:3677:46: note: 'v8::Extension::source' declared here
  const String::ExternalAsciiStringResource* source() const {
                                             ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:407:36: error: must explicitly qualify name of member function when taking its address
        v8::Isolate::GetCurrent(), &source);
                                   ^~~~~~~
                                    Extension::
../node_modules/nan/nan.h:432:36: error: too many arguments to function call, expected single argument 'value', have 2 arguments
        v8::Isolate::GetCurrent(), val).As<v8::NumberObject>();
                                   ^~~
/Users/glavin/.atom/.node-gyp/.node-gyp/0.11.10/deps/v8/include/v8.h:2869:3: note: 'New' declared here
  static Local<Value> New(double value);
  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/pathwatcher/src/main.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 13.2.0
gyp ERR! command "node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/glavin/Documents/Project_Dev/atom-preview/node_modules/pathwatcher
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the pathwatcher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls pathwatcher
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.2.0
npm ERR! command "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/.apmrc" "--userconfig" "/Users/glavin/.atom/.apmrc" "install" "--target=0.11.10" "--arch=x64"
npm ERR! cwd /Users/glavin/Documents/Project_Dev/atom-preview
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/glavin/Documents/Project_Dev/atom-preview/npm-debug.log
npm ERR! not ok code 0
glavin@GlavinBook-Pro:~/Documents/Project Dev/atom-preview$ "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/.apmrc" "--userconfig" "/Users/glavin/.atom/.apmrc" "install" "--target=0.11.10" "--arch=x64"

> [email protected] install /Users/glavin/Documents/Project_Dev/atom-preview/node_modules/pathwatcher
> node-gyp rebuild

2014-08-09 22:33:30.296 xcodebuild[97313:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XToDo.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-08-09 22:33:30.297 xcodebuild[97313:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XAlign.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2014-08-09 22:33:30.298 xcodebuild[97313:1007] [MT] PluginLoading: Required plug-in compatibility UUID A2E4D43F-41F4-4FB9-BB94-7177011C9AED for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/SCXcodeMinimap.xcplugin' not present in DVTPlugInCompatibilityUUIDs
  CXX(target) Release/obj.target/pathwatcher/src/main.o
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:342:74: error: too many arguments to function call, expected at most 3, have 4
    return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
           ~~~~~~~~~~~~~~~~~~                                            ^~~~
/Users/glavin/.node-gyp/0.11.10/deps/v8/include/v8.h:3585:3: note: 'New' declared here
  static Local<Signature> New(Handle<FunctionTemplate> receiver =
  ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:370:27: error: cannot initialize a parameter of type 'int' with an rvalue of type 'v8::Isolate *'
    return v8::Array::New(v8::Isolate::GetCurrent());
                          ^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/glavin/.node-gyp/0.11.10/deps/v8/include/v8.h:2335:31: note: passing argument to parameter 'length' here
  static Local<Array> New(int length = 0);
                              ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:375:54: error: too many arguments to function call, expected at most single argument 'length', have 2 arguments
    return v8::Array::New(v8::Isolate::GetCurrent(), length);
           ~~~~~~~~~~~~~~                            ^~~~~~
/Users/glavin/.node-gyp/0.11.10/deps/v8/include/v8.h:2335:3: note: 'New' declared here
  static Local<Array> New(int length = 0);
  ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:380:53: error: too many arguments to function call, expected single argument 'time', have 2 arguments
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
           ~~~~~~~~~~~~~                            ^~~~
/Users/glavin/.node-gyp/0.11.10/deps/v8/include/v8.h:2866:3: note: 'New' declared here
  static Local<Value> New(double time);
  ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:380:70: error: expected '(' for function-style cast or type construction
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
                                                             ~~~~~~~~^
../node_modules/nan/nan.h:380:72: error: expected expression
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
                                                                       ^
../node_modules/nan/nan.h:385:53: error: too many arguments to function call, expected single argument 'time', have 2 arguments
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
           ~~~~~~~~~~~~~                            ^~~~
/Users/glavin/.node-gyp/0.11.10/deps/v8/include/v8.h:2866:3: note: 'New' declared here
  static Local<Value> New(double time);
  ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:385:70: error: expected '(' for function-style cast or type construction
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
                                                             ~~~~~~~~^
../node_modules/nan/nan.h:385:72: error: expected expression
    return v8::Date::New(v8::Isolate::GetCurrent(), time).As<v8::Date>();
                                                                       ^
../node_modules/nan/nan.h:388:15: error: no type named 'UnboundScript' in namespace 'v8'
  typedef v8::UnboundScript NanUnboundScript;
          ~~~~^
../node_modules/nan/nan.h:396:9: error: no member named 'ScriptCompiler' in namespace 'v8'
    v8::ScriptCompiler::Source source(s, origin);
    ~~~~^
../node_modules/nan/nan.h:397:16: error: no member named 'ScriptCompiler' in namespace 'v8'
    return v8::ScriptCompiler::CompileUnbound(
           ~~~~^
../node_modules/nan/nan.h:398:37: error: use of undeclared identifier 'source'; did you mean 'v8::Extension::source'?
        v8::Isolate::GetCurrent(), &source);
                                    ^~~~~~
                                    v8::Extension::source
/Users/glavin/.node-gyp/0.11.10/deps/v8/include/v8.h:3712:46: note: 'v8::Extension::source' declared here
  const String::ExternalAsciiStringResource* source() const {
                                             ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:398:36: error: must explicitly qualify name of member function when taking its address
        v8::Isolate::GetCurrent(), &source);
                                   ^~~~~~~
                                    Extension::
../node_modules/nan/nan.h:405:9: error: no member named 'ScriptCompiler' in namespace 'v8'
    v8::ScriptCompiler::Source source(s);
    ~~~~^
../node_modules/nan/nan.h:406:16: error: no member named 'ScriptCompiler' in namespace 'v8'
    return v8::ScriptCompiler::CompileUnbound(
           ~~~~^
../node_modules/nan/nan.h:407:37: error: use of undeclared identifier 'source'; did you mean 'v8::Extension::source'?
        v8::Isolate::GetCurrent(), &source);
                                    ^~~~~~
                                    v8::Extension::source
/Users/glavin/.node-gyp/0.11.10/deps/v8/include/v8.h:3712:46: note: 'v8::Extension::source' declared here
  const String::ExternalAsciiStringResource* source() const {
                                             ^
In file included from ../src/main.cc:1:
In file included from ../src/common.h:6:
../node_modules/nan/nan.h:407:36: error: must explicitly qualify name of member function when taking its address
        v8::Isolate::GetCurrent(), &source);
                                   ^~~~~~~
                                    Extension::
../node_modules/nan/nan.h:432:36: error: too many arguments to function call, expected single argument 'value', have 2 arguments
        v8::Isolate::GetCurrent(), val).As<v8::NumberObject>();
                                   ^~~
/Users/glavin/.node-gyp/0.11.10/deps/v8/include/v8.h:2904:3: note: 'New' declared here
  static Local<Value> New(double value);
  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/pathwatcher/src/main.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 13.2.0
gyp ERR! command "node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/glavin/Documents/Project_Dev/atom-preview/node_modules/pathwatcher
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the pathwatcher package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls pathwatcher
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.2.0
npm ERR! command "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/.apmrc" "--userconfig" "/Users/glavin/.atom/.apmrc" "install" "--target=0.11.10" "--arch=x64"
npm ERR! cwd /Users/glavin/Documents/Project_Dev/atom-preview
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/glavin/Documents/Project_Dev/atom-preview/npm-debug.log
npm ERR! not ok code 0

@Glavin001
Copy link
Owner Author

Removing "text-buffer": "^3.0.0" fixes this. However, I need text-buffer......

@Glavin001
Copy link
Owner Author

So my workaround for accessing TextBuffer and EditorView:

TextBuffer = atom.deserializers.deserializers.TextBuffer
Editor = atom.deserializers.deserializers.Editor

Glavin001 added a commit that referenced this issue Aug 10, 2014
Also cleaned up console.log and other misc code.
@Glavin001
Copy link
Owner Author

New UI for showing messages:

image

Glavin001 added a commit that referenced this issue Aug 10, 2014
Complete implementation of PreviewView extending EditorView.
Glavin001 added a commit that referenced this issue Aug 11, 2014
Instead of forcing React to be enabled and
requiring the exported modules from require('atom')
use the resourcePath from atom.config.resourcePath
and build the absolute path to the Atom internal modules
and reqire them directly.
Glavin001 added a commit that referenced this issue Aug 11, 2014
Closes #32. PreviewView now extends ReactEditorView.
@nathansobo
Copy link

@Glavin001 Just curious, would it be helpful to be able to build a standard Atom text-editor in a read-only mode, or there additional features you need that require a custom subclass?

@Glavin001
Copy link
Owner Author

@nathansobo:

features you need that require a custom subclass

I subclassed the (React)EditorView because I wanted to have the PreviewView handle it's own previewing of the user's active Editor -- the PreviewView class observes changes to the active Editor and update it's own text. More importantly, I required a custom overlay to support previewing with raw SpacePen View / HTML elements, such as would be required with #47 (SpacePen support) and #7 (Markdown support).

would it be helpful to be able to build a standard Atom text-editor in a read-only mode,

Read-only mode would be nice. It was requested by a user. I did have another idea about reversing the preview: preview the CoffeeScript in JavaScript, edit the JavaScript preview and it'll consequently edit the original CoffeeScript respectively. I doubt I'll ever implement that though, so read-only would be good.

It has also been requested that the Preview be savable ( #20 ), however I have been unable to trigger the save dialog to appear with cmd+s. I think I may be doing something wrong with the instance of the TextBuffer I pass to the Editor used for the PreviewView.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants