cirsfid-unibo / lime

LIME (Language Independent Markup Editor)
http://lime.cirsfid.unibo.it/
29 stars 14 forks source link

confused by LIME "plugins" #44

Closed kohsah closed 8 years ago

kohsah commented 8 years ago

I am a bit confused by what exactly a LIME plugin is ? From what i can see its not an Ext JS plugin... but an extended class with custom config specifiying the pluginName . But what does that imply in using it within LIME ?

For example, if I want to add a custom functionality as Tab in LIME ... e.g. a new kind of preview is that a case for a plugin ?

obujor commented 8 years ago

A LIME plugin is not an Ext JS plugin but a Sencha Cmd package, which implements some custom functonality that can be included or not at compilation time. This is generic it can be some GUI components or/and some behaviors.

The classes inside a package almost always extends from some other class (unless you want to implement a class from scratch) because in Ext JS there are basic classes which can be extended.

The "pluginName" config is used for getting the plugin's strings like this: Locale.getString("hello", this.getPluginName()) it's not mandatory you may also get the string with: Locale.getString("hello", "mypackagename") but every time you need to repeat "mypackagename".

Every new class must be requested in some place for building reasons so you cannot require it from lime-core because the core doesn't know about its existence, so you can include this classes by overriding the core application from the package itself, for example look here or every other package.

If you want to create an Editor tab, it could be contained in a package and a package can contain more editor tabs not just one, so you need to consider if the Tab has sense to be a package inluded in a dedicated package or just adding to one of the existing packages. For example the 'akn-tab-xml-preview' is a package which contains one tab only and it was created before the other akn-* packages, now it doesn't have sence to be a package itself but can be included in another akn-* package.

For creating Editor Tabs (tabs which are in the middle next to the Editor tab as Akn preview) you have to create a panel (because the container is a Tab Panel) with the 'editorTab' class (this class is used by the lime-core to manage the tabs): cls : 'editorTab' There's another step to do in order to have the Tab in the "Window->Show view" menu, that is to include the alias of the tab in the 'viewConfigs.json' file, which contains a list of allowed views for the chosen configuration, so you can do a Tab which will be shown only for a certain locale or a certain doc type.

kohsah commented 8 years ago

Thanks @obujor , Really appreciate your detailed responses