orion.core.contenttype | ||
---|---|---|
![]() |
![]() |
|
orion.navigate.openWith | Updating this document |
The content type service tells Orion about a new kind of file. The content types contributed to this service don't have any direct effect on the Orion UI, but they can be referred to by other services that need to associate themselves with a particular kind of file. For an example, see orion.navigate.openWith.
The Orion client UI defines a bunch of content types by default, including JavaScript, CSS, HTML, Markdown, and several others. See webEditingPlugin.js
in the client UI code for a full list. (If you are contributing tools that deal with one of Orion's predefined content types, you
must use the same content type ID rather than define your own, as file extensions can be registered by only a single content type.)
ContentType[]
. An array of one or more content types to register. Each element of the array defines a new content type.
A ContentType object has the following shape:
None. This service is purely declarative.
This example code contributes contributes a new content type for Perl files. A Perl file extends from "text/plain"
and has the extension .pl
.
provider.registerServiceProvider("orion.core.contenttype", {}, { contentTypes: [ { id: "application/perl", name: "Perl", extension: ["pl"], "extends": "text/plain" } ]}); provider.connect();
The example code below contributes a new content type for Maven build files. A Maven build file is a special kind of XML file that always has the name "pom.xml".
provider.registerServiceProvider("orion.core.contenttype", {}, { contentTypes: [ { id: "text/x-maven-pom", name: "Maven build file", filename: ["pom.xml"], "extends": "application/xml", imageClass: "orion-maven-sprite" } ]}); provider.connect();
![]() |
![]() |
![]() |
orion.navigate.openWith | Updating this document |