/files_texteditor

Primary LanguageJavaScriptGNU Affero General Public License v3.0AGPL-3.0

Texteditor

Build Status Quality Gate Status Security Rating Coverage

The original text editor app for ownCloud, based on Ace.

Features:

  • Syntax highlighting
  • Autosave
  • Syntax checking
  • Responsive design (optimised on mobile and desktop)

Install

Simply copy the files_texteditor folder into the apps directory and enable the app within the ownCloud settings.

Usage

To use the editor, click on a supported file within the Files app and the file will be loaded into the editor. Saving is automatic, but can also be triggered manually with Ctrl+S or Cmd+S.

Contributors

Maintainer: Tom Needham Past contributors: Thomas Müller Robin Appelman Jörn Friedrich Dreyer Vincent Petry

Preview apps

Apps can add side-by-side previews to the app for certain file types by using the preview api

OCA.MYApp.Preview = function(){
    ...
}

OCA.MYApp.Preview.Prototype = {
    /**
     * Give the app the opportunity to load any resources it needs and prepare for rendering a preview
     */
    init: function() {
        ...
    },
    /**
     * @param {string} the text to create the preview for
     * @param {jQuery} the jQuery element to render the preview in
     */
    preview: function(text, previewElement) {
        ...
    }
}

OCA.Files_Texteditor.registerPreviewPlugin('text/markdown', new OCA.MYApp.Preview());

For styling of the preview, the preview element will have the id preview and the className will be set to the mimetype of the file being edited with any slash replaced by dashes.

e.g. when editing a markdown file the preview element can be styled using the #preview.text-markdown css query.