-
Notifications
You must be signed in to change notification settings - Fork 23
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
Comments
@Glavin001 Did you get my message on gitter? |
Oh, I see it now. Sorry I just got home and had not even opened up Gitter yet. |
@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
We should actually have a VERY small (in comparison) |
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 |
No worries, @ddavison. I'll take a shot at it and see how it goes. |
i can push my dev branch that i was on if you'd like. |
Sure, that'd be great! Thanks. How far did you get? |
|
See atom/atom@fb4361e |
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! |
|
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. |
I had manually copied the Atom's 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 |
Removing |
So my workaround for accessing TextBuffer = atom.deserializers.deserializers.TextBuffer
Editor = atom.deserializers.deserializers.Editor |
Also cleaned up console.log and other misc code.
Complete implementation of PreviewView extending EditorView.
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.
Closes #32. PreviewView now extends ReactEditorView.
@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? |
I subclassed the
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 |
This will fix issues #31 (line numbers), #25 (font-size syncing), and #27 (theme applying), #20 (saving preview).
The text was updated successfully, but these errors were encountered: