szannia / editor-bundle

该包已被废弃,不再维护。未建议替代包。

Symfony EditorBundle

安装: 164

依赖: 0

建议者: 0

安全: 0

星标: 2

关注者: 4

分支: 0

开放问题: 0

类型:symfony-bundle

1.1.1 2014-11-24 09:03 UTC

This package is not auto-updated.

Last update: 2017-10-27 08:24:50 UTC


README

#Sizannia 编辑器

安装

在 composer.json 文件中需要此包

{
    "require": {
        "sizannia/editor-bundle": "1.*",
    }
}

安装此包

$ php composer.phar update

将 Sizannia 编辑器包添加到 AppKernel.php 文件中

<?php
 public function registerBundles() {
        $bundles = array(
            ...
            new Sizannia\EditorBundle\SizanniaEditorBundle(),
            ...
        );
}

配置

layout.html.twig

在 JavaScript 块中添加以下行

{% include "SizanniaEditorBundle:Layout:sizannia.html.twig" with {'lang': lang }%}

使用 "lang" 设置您网站的语言

routing.yml

sizannia_editor:
    resource: "@SizanniaEditorBundle/Resources/config/routing.xml"

使用方法

此配置仅为示例。您可以在不包含此配置的情况下使用此包。

config.yml

sizannia_editor:
	plugins:
		# You can add your custom plugin
        wenzgmap:
			enable:     false | true
			path:       "bundles/acmedemo/plugins/wenzgmap/"
			filename:   "plugin.js"
        youtube:
			enable:     false | true
			path:       "bundles/acmedemo/plugins/youtube/"
			filename:   "plugin.js"
	# CKFinder is a file explorer. You can include an image in a text
	ckfinder:   true | false
	#You can change the display of the toolbar. This configuration is common to all editors
	toolbars:
		- { name: 'document', items: [ 'Source', '-', 'NewPage', 'Preview', '-', 'Templates', '/' ] }
		- { name: 'document', items: ['/'] } # New Line
		- { name: 'default', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] }
		- { name: 'default2', items: [ 'Bold', 'Italic' ] }
	# You can remove one or many plugins
	removePlugins: about, find, save, templates, dialogadvtab, div, forms, newpage, bidi, flash, table, tabletools, pagebreak, maximize, showblocks, preview, print
	# If you want you can add style for html element
	styles:
		- {name: "Titre Paragraphe", element: 'p', attributes: {'class': 'paragraph-title'}}
		- {name: "Titre Contact / SavoirPlus", element: 'p', attributes: {'class': 'encart-title'}}
		- {name: "Titre Saviez-Vous", element: 'p', attributes: {'class': 'saviez-title'}}
		- {name: "SousTitre Saviez-Vous", element: 'p', attributes: {'class': 'saviz-undertitle'}}
		- {name: "Titre Pack Accueil Lieu", element: 'span', attributes: {'class': 'lieu'}}
		- {name: "Titre Pack Accueil Fr?quence", element: 'span', attributes: {'class': 'frequence'}}
		- {name: "Titre Pack Accueil Aller", element: 'span', attributes: {'class': 'amplitude-aller'}}
		- {name: "Titre Pack Accueil Retour", element: 'span', attributes: {'class': 'amplitude-retour'}}
		- {name: "Titre Contact", element: 'span', attributes: {'class': 'title-contact'}}
		- {name: "SousTitre Contact", element: 'span', attributes: {'class': 'sous_title-contact'}}
		- {name: "Lien Site Contact", element: 'span', attributes: {'class': 'website-contact'}}
		- {name: "Lien Mail Contact", element: 'span', attributes: {'class': 'mail-contact'}}

表单

在此示例中,可选,您可以根据例如用户权限更改工具栏的组成。

$this->createFormBuilder($task)
    ->add('description', "sizannia_editor_type", array(
            'config' => array(
                  'toolbar' => array(
                        array(
                              'name' => 'document',
                              'items' => array('Source', 'Save', 'NewPage', 'DocProps', 'Preview', 'Print', '-', 'Templates'),
                        ),
                        '/',
                        array(
                              'name' => 'basicstyles',
                              'items' => array('Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'),
                        )
                  )
            )
		)
	)