New editor for new content type [message #1599842] |
Tue, 03 February 2015 23:00  |
Hemant Kolwalkar Messages: 17 Registered: July 2009 |
Junior Member |
|
|
I am working on a prototype (adding a new editor for a new content type extension) with Orion. I have followed the examples available online and been able to implement except for one aspect.
My question is how does a remote service provider (in this case MyEditor.jsp) get hold of the contents of the file in order to edit and then save the modified content back? I do not see any EditorContext (ObjectReference) available for these extensions.
Any help would be appreciated.
// Declare an editor
provider.registerServiceProvider("orion.edit.editor", {}, {
id: "my.editor",
name: "My Editor",
uriTemplate: "{+OrionHome}/content/content.html#{+Location},contentProvider=my.content"});
// Declare content types
provider.registerServiceProvider("orion.core.contenttype", {}, {
contentTypes:
[{ id: "application/myown",
"extends": "application/xml",
name: "MYOWN",
extension: ["myown"]
}]
});
// Associate editor with content types
provider.registerServiceProvider("orion.navigate.openWith", {}, {
editor: "my.editor",
contentType: ["application/myown"]});
provider.registerServiceProvider("orion.page.content", {}, {
id: "my.content",
name: "My Content",
saveToken: [{token: "myownapi?myown=", terminator: "&"}],
uriTemplate: "http://localhost:9999/MyEditor.jsp?myown={+OrionHome}{+Location}&referrer=Orion&title={Name}&locktype=false&exit={+ExitURL}&target={+SaveURL}pdmapi&locktitle=false,contentProvider=my.content"});
provider.connect(
function() {
console.log('my editor connected.');
},
function(e) {
throw e;
});
thanks,
- Hemant
|
|
|
Re: New editor for new content type [message #1604084 is a reply to message #1599842] |
Fri, 06 February 2015 16:21  |
Mark Macdonald Messages: 35 Registered: July 2009 |
Member |
|
|
The EditorContext API currently does not offer direct access to the filesystem. This is by design.
There's a few different ways you can approach this:
- Co-locate MyEditor.jsp on the Orion back end server, where it can access the user's workspace directly through the filesystem on the server.
- Locate MyEditor.jsp on a remote server R, but set up some kind of server-to-server communication between R and the Orion server, such that R can access the user's workspace. The channel between the 2 servers would be "out-of-band" with respect to Orion.
- This is similar to option #1, but done through the client rather than the server:
Host MyEditor.jsp on the same origin as the Orion client code. MyEditor.jsp loads Orion's bootstrap.js module. Then the Orion FileClient API can be invoked to to read & modify files from the user's workspace, with the same privileges as the main Orion page.
This is the approach currently used by some plugins that ship with Orion that need direct filesystem access, like javascriptPlugin.
[Updated on: Fri, 06 February 2015 16:22] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02129 seconds