承接 nathancox/codeeditorfield 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nathancox/codeeditorfield

Composer 安装命令:

composer require nathancox/codeeditorfield

包简介

A field for editing code and JSON in the SilverStripe CMS using Ace Editor (http://ace.c9.io/)

README 文档

README

This module adds a CodeEditorField that uses Ace Editor (http://ace.c9.io/) to let you edit code (mostly HTML or JavaScript). Try it out here. It comes in two forms:

  • A regular CodeEditorField that can be used on an HTMLText field similar to HTMLEditorField
  • An optional replacement code view for TinyMCE that uses a CodeEditorField

Maintainer Contacts

Nathan Cox (me@nathan.net.nz)

Requirements

  • SilverStripe 3.1+

Documentation

GitHub

Installation Instructions

  1. Place the files in a directory called codeeditorfield in the root of your SilverStripe installation. You can most easily do this with composer require nathancox/codeeditorfield
  2. Configure your site's config.yml to define your defaults (optional).
  3. Visit yoursite.com/dev/build to rebuild the database

Usage Overview

Configuration via config.yml:

---
Name: codeeditorfield
---

CodeEditorField:
    # These are the pre-defined defaults for dark/light themes
    default_dark_theme: 'monokai'
    default_light_theme: 'github'
    
    # This will overwrite the above settings
    default_theme: 'tomorrow'
    

Using CodeEditorField in getCMSFields:

	
$fields->addFieldToTab('Root.Content', $codeField = new CodeEditorField('Configuration', 'Configuration'));
// set the field to use the full width of the CMS (optional, not included in screenshot)
$codeField->addExtraClass('stacked');

// set the height of the field (defaults to 8)
$codeField->setRows(30);

// set the syntax mode to yaml (defaults to html)
$codeField->setMode('yaml');

// optional - set theme (see codeeditorfield/thirdparty/ace/src-noconflict/theme-xxx.js files for available themes)
$codeField->setTheme('twilight');

produces the following:

example codeeditorfield

Note: If you opt not to set default_theme and don't set the theme specifically on the field, you will have the option to toggle between Dark and Light.

To replace the code editor in TinyMCE:

// copy this into your project's getCMSFields

HtmlEditorConfig::get('cms')->enablePlugins(array(
	'aceeditor' => sprintf('../../../codeeditorfield/javascript/tinymce/editor_plugin_src.js')
));
HtmlEditorConfig::get('cms')->insertButtonsBefore('fullscreen', 'aceeditor');
HtmlEditorConfig::get('cms')->removeButtons('code');

Known Issues

Issue Tracker

统计信息

  • 总下载量: 49.17k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 25
  • 点击次数: 1
  • 依赖项目数: 6
  • 推荐数: 1

GitHub 信息

  • Stars: 25
  • Watchers: 2
  • Forks: 12
  • 开发语言: JavaScript

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2013-09-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固