ProcessFileEdit by matjazp

A ProcessWire module for editing files in the admin area.

ProcessFileEdit

Allow modal editing of files on the filesystem. The list of directories and files are displayed, clicking on file opens modal window with the codemirror editor. If the file is an image, the viewer is opened in modal. If the file is used as a template, link to the template edit is provided. Intended primarily for superusers, give other users file-edit permission.

This is not the replacement for a full-blown editor. Be aware that if you make changes to files that cause PW to throws an error in admin, you lose access to this module too and you will need some other means to access the file again!

Options


Directory path

The path to the directory from which to display directory tree. By default it's set to $config->paths->site

File encoding

The encoding used when saving file name. Different operating systems and underlying filesystem use different ways of how filenames are stored on the filesystem. This setting allows you to overcome situations when file name become garbled after save operation. Options are: 'Auto detect' (this is default), 'Windows-1250', 'Windows-1252', 'ISO-8859-2', 'PHP's urldecode' and 'none'.

Line endings

Type of line endings to use when saving. CodeMirror returns end-of-line as Windows style end-of-line (\r\n). Here you can set up how to handle this. Default is 'Auto detect' that try to detect original line endings and apply them on save. You may manually set line endings to Windows (\r\n), Linux (\n) or Mac (\r) style.

Extensions filter

Comma separated list of extensions to filter files by. By default "php,module,js,css".

Include or exclude extensions

Select to include or exclude files based on the extensions defined in Extension Filter. Include is the default, so files matching extensions will be displayed in directory/file tree.

Backup extension

Extension to use when backing up edited file, for example ".bak" ("." is prepended if omitted). Leave empty for no backup (this is default).

Dotfiles exclusion

Check to exclude files and folders starting with a dot (.) like .gitignore, .htaccess etc. The default is unchecked. This option also hides the old versions of site modules that were created by Ryan's Upgrades module showing up when browsing /site/modules. You can add "htaccess" and other extensions to the extensions filter to allow those.

Editor height

The height of the editor textarea, the default is "auto", can be any height like "450px".

Line wrapping

Make long lines in the editor wrap. Default is on.

Codemirror theme

List of themes supported by CodeMirror, see demo. The default theme is "default".

Installation


Copy the files to the /site/modules/ProcessFileEdit folder, log in to your ProcessWire admin and go to the Modules page. Click the Refresh button and then Install. More info at http://modules.processwire.com/install-uninstall/

License


Copyright (c) 2016 Florea Banus George (https://github.com/f-b-g-m/ProcessFileEdit).
Fork by Matjaž Potočnik (https://github.com/matjazpotocnik/ProcessFileEdit).
Big thanks to Roland Toth.
Support forum: https://processwire.com/talk/topic/14276-file-editor/

Licensed under the MIT license. See the LICENSE file for details.

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • ProcessWire 3.0.171 dev branch core updates – More
    22 January 2021
  • Preliminary 2021 roadmap in progress in this week’s update— More
    8 January 2021
  • Happy New Year! Today I’ve bumped the version on the dev branch to 3.0.170, and it’s quite a lot of updates. This post covers most of them. In this post, there’s also a question for you: what would you like to see in ProcessWire in 2021? More
    1 January 2021

Latest news

  • ProcessWire Weekly #349
    In the 349th issue of ProcessWire Weekly we're going to cover the latest core and forum updates, introduce some recent ProcessWire resources, and more. Read on!
    Weekly.pw / 16 January 2021
  • ProcessWire 3.0.170 core updates
    Happy New Year! Today I’ve bumped the version on the dev branch to 3.0.170, and it’s quite a lot of updates. This post covers most of them. In this post, there’s also a question for you: what would you like to see in ProcessWire in 2021?
    Blog / 1 January 2021
  • Subscribe to weekly ProcessWire news

“We were really happy to build our new portfolio website on ProcessWire! We wanted something that gave us plenty of control on the back-end, without any bloat on the front end - just a nice, easy to access API for all our content that left us free to design and build however we liked.” —Castus, web design agency in Sheffield, UK