loicpennamen/sf-front-editor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

loicpennamen/sf-front-editor

最新稳定版本:1.2.0

Composer 安装命令:

composer require loicpennamen/sf-front-editor

包简介

Content editor for Symfony.

关键字:

README 文档

README

This is an "in-page" content editor for Symfony 4+ applications. This package aims to provide user with a fast RTE editor for HTML blocks, thus improving content integration and webpage design.

The RTE is accessible by users logged in with specific rights. These users can update contents with a WYSIWYG editor on the fly.

Contents are then saved in hard files, under the /var directory, and backups are generated with an automatic rotation (ie. "old" contents are automatically deleted).

Since HTML contents are stored under the /var folder, editions can by default be tracked on GIT. Filenames contain a timestamp, so contents edited in production will not overwrite versioned content, and can also be versioned on their end.

Installation

  • Add to your project using composer:

      composer require loicpennamen/sf-front-editor
    
  • Include required assets in your app's javascript app.js:

      require('../../vendor/loicpennamen/sf-front-editor/sf-front-editor');
    
  • A stable version of CKEditor is included in the bundle and needs to be copied under the public folder. Add these to your webpack.config:

      module.exports = {
          // (...)
      
          plugins: [          
              // (...)
    		
              new CopyPlugin({
                  patterns: [
                      { from: "./vendor/loicpennamen/sf-front-editor/assets/required", to: "assets/skins" },
                  ],
              }),
      
          ]
      }
    
  • Add routes in /config/routes.yaml:

      sfe:
        resource: '../vendor/loicpennamen/sf-front-editor/Controller/'
        type: annotation
    
  • Add Twig templates folder `/config/packages/twig.yaml`:

      twig:
        paths:
          'vendor/loicpennamen/sf-front-editor/templates': FrontEditorBundle
    
  • Provide some users with ROLE_FRONT_EDITOR to allow for modifying any content. Example in `security.yml` :

      role_hierarchy:
        ROLE_ADMIN: ROLE_FRONT_EDITOR
    
  • To display an editable content block in Twig template, use this function:

      {{ sfe('my_block_slug') }}
    

    The value of my_block_slug can be any string containing lowercase letters, numbers, lines (-) and dash (_). It is a unique identifyer for the content, shared for every available language. Ie. you do not need to create a slug_en and a slug_es, the package will handle that part.

  • Current language is used by default. To specify another language, pass the locale as second parameter :

      {{ sfe('my-block-slug', 'fr') }}
    
  • Styles can be overriden in CSS with class prefix sfe- :

    • sfe-front-button : Button opening the edition modale
    • sfe-content-wrapper : HTML wrapper around the content in front-end
    • sfe-content-wrapper-editable : HTML wrapper when edition is allowed
    • sfe-toolbar : Appears on top on content, when user is allowed to edit

TO-DOs

  • Add file manager
  • Allow custom config
  • Translations
  • Add file metas (Author) and display in history
  • Handle Ctrl-S
  • Simplify installation by adding SF recipes
  • Rename SF...plugins to SFE...
  • Debug dlete "Remove video" button in app.js

Development

During develoment, install assets with npm install then watch with node_modules\.bin\webpack.cmd.

Who do I talk to?

Loïc Pennamen
http://loicpennamen.com

统计信息

  • 总下载量: 1.52k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固