silverstripe-australia/frontend-editing

一个模块,允许通过前端、即时所见即所得界面编辑HTML字段。

安装: 408

依赖者: 0

建议者: 0

安全: 0

星标: 23

关注者: 4

分支: 4

开放问题: 6

语言:JavaScript

类型:silverstripe-module

1.0.0 2015-01-19 01:40 UTC

This package is auto-updated.

Last update: 2024-08-29 03:35:49 UTC


README

维护者联系方式

Marcus Nyeholt

<marcus (at) silverstripe (dot) com (dot) au>

要求

SilverStripe 3.0

文档

SilverStripe 2.4版本在ss24分支中仍然可用

前端编辑模块允许在网站的页面上编辑基于HTML的内容。开发者在模板中指定他们想要编辑的字段,添加用于在编辑和标准视图之间切换的按钮的包含项,这就是全部。

将以下内容添加到您项目的配置.yml文件中

---
Name: frontend_config
---
SiteTree:
  extensions:
    - FrontendEditableExtension

```

In the templates for the page types you would like editable, add the 
following in place of raw output fields - for example, instead of `$Content`, 
use

$EditableField(Content)


As well as single fields of the current page, you can use it on 
other objects contained in a control block (so long as those
objects have the EditableExtension)

    <% control Items %>
  • $EditableControl(Title)
  • <% end_control %>
````

在您的模板中,请在顶部添加以下内容。它包含一些用于启动编辑器的控件(如果需要的话)。您可以为启动编辑器提供自己的机制,但这更简单:)

<% include FrontendEditingControls %>

注意:添加上述内容后,在“实时”模式下导航到页面时,如果您有权编辑页面,将鼠标悬停在屏幕的右下角将显示启动编辑模式的控件。在“阶段”视图中,这些控件应立即出现。

API

为编辑器定义新的插件

@TODO - 目前,请参阅nicedit-image-selector.js或nicedit-url-selector.js作为示例。

故障排除

  • ?stage=Stage&startEditing=true附加到当前URL将立即打开编辑器;如果这没有发生,请检查您的JS错误控制台!