Giter VIP home page Giter VIP logo

bueditor's Introduction

BUEditor

A plain textarea editor aiming to facilitate code and regular writing. It allows you to:

  • build the editor from scratch.
  • determine the functionality by defining image or text buttons that generate code snippets, HTML tags, Markdown, BBCode tags etc.
  • determine the design and layout by defining theme buttons that insert html to the layout.

HOW TO INSTALL:

  • Install this module using the official Backdrop CMS instructions at https://backdropcms.org/guide/modules
  • Add/edit editors at admin/config/content/bueditor.
  • There are default editors you can use as a starting point for writing HTML, Markdown, and BBCode
  • You may install IMCE module to use it as a file/image browser in editor's image & link dialogs.
  • Make sure your input format does not filter the tags the editor inserts.

ADVANCED USAGE:

See ADVANCED.md

LICENSE

This project is GPL v2 software. See the LICENSE.txt file in this directory for complete text.

CURRENT MAINTAINERS

CREDITS

This module was ported to Backdrop by @docwilmot. BUEditor was originally created for Drupal by Ufku.

bueditor's People

Contributors

alanmels avatar docwilmot avatar drprofesq avatar findlabnet avatar herbdool avatar podarok avatar quicksketch avatar sbordage avatar ufku avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bueditor's Issues

Remove unnecessary `bueditor_editors` and `bueditor_buttons` database tables

The modules maintains bueditor_schema() just for providing upgrade path for Drupal 7 websites, but during installation converts all entries from the bueditor_editors and bueditor_buttons tables to Backdrop style configuration settings and then tries to delete the database table which by that time become unnecessary, but fails to do so.

The reason is incorrect implementation of backdrop_uninstall_schema() function, which expects the module name as function argument:

function backdrop_uninstall_schema($module) {
  $schema = backdrop_get_schema_unprocessed($module);
  _backdrop_schema_initialize($schema, $module, FALSE);

  foreach ($schema as $table) {
    if (db_table_exists($table['name'])) {
      db_drop_table($table['name']);
    }
  }
}

whereas this module is using the database table names instead:

  backdrop_uninstall_schema('bueditor_editors');
  backdrop_uninstall_schema('bueditor_buttons');

BU editor shows on plain text fields

Steps to reproduce

  1. Install BU editor on site
  2. Check that plain text 'text editor' setting is set to None
  3. Add a text field (either short or long) to a content type with Text area widget and set Text processing to Plain text rather than Filtered text
  4. Create new content with the content type

Expected result : field has plain text area box
image

Actual result : field has BU editor text area box
image

There is a comparable D7 issue - https://www.drupal.org/project/bueditor/issues/1931862 and there is a patch. However, the function and variables looks quite different in that function in the Backdrop module so I'm not sure if it can be used directly:

diff --git a/bueditor.inc b/bueditor.inc
index d4af194..66899df 100644
--- a/bueditor.inc
+++ b/bueditor.inc
@@ -81,6 +81,17 @@ function _bueditor_textarea($element, $form_state) {
   }
   $textareas[$element['#id']] = TRUE;
 
+  // Check if this field instance has text processing enabled (filtered text
+  // with text format selection).
+  if (isset($element['#entity_type']) && isset($element['#field_name']) && $element['#bundle']) {
+    $instance = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
+    // If text processing is 0 (plain text), don't show the editor for this
+    // textarea (plain text format doesn't allow any html).
+    if (!empty($instance) && empty($instance['settings']['text_processing'])) {
+      return $element;
+    }
+  }
+
   // Get editors
   if (!isset($editors)) {
     $editors = bueditor_user_eids($GLOBALS['user']);

Incorporate markdowneditor library and buttons

This would incorporate buttons array and js library from the markdowneditor module. BUEditor already includes BBCode but markdown is being used a lot more now (github!). It's a small enough addition that it's easier to incorporate rather than just share in some other manner.

Implement hook_editor_info()

Implement hook_editor_info() as otherwise BUEditor does not show up in the list of text editors when configuring a filter, for example on /admin/config/content/formats/filtered_html.

Visibility of the Bueditor buttons - strange behavior and strange solution

I installed bueditor-1.x-2.1 to backdrop-1.2.2 and assign Default Editor to User 1.

But when starring new or editing an existing page, Bueditor buttons were not shown in the Body text area, but they were visible in the Summary text area (If it was activated).

Body text area showed only the buttons of CKEditor but not those of Bueditor. Summary text area showed only buttons of Bueditor, but not those of CKEditor.

I've tried different solutions โ€“ I have reinstalled, deleted the cache, I tried all kinds of settings.

Finally I created a new text input text format (named Coder) similar to the Full HTML - without any html restriction or filters. I just wanted to see if the problem would exist it with a new text format

It all started to work fine - both Bueditor and CKEditor become vissible at both Body and Summary text areas. In all text formats including default Filtered HTML and Full HTML.

After deleting newly created Coder text format both Bueditor and CKEditor buttons continue to work fine and now are visible in both Body and Summary text areas in Filtered HTML and Full HTML.

Allow bueditor to be an "editor" in Backdrop, so that it can be attached to individual text formats

Every backdrop text format can have a specific editor assigned -- but BUeditor does not seem to be available after enabling the module. Instead, it appears that BUeditor is being attached to every text area, regardless of text format, or any other editors that are already on that format.

BUeditor does not seem to work at all when it's on a format that also has ckeditor on it. If it were available as an "editor" then only one editor would be allowed on the format, preventing this broken state.

PHP Deprecated: Optional parameter $bids declared before required parameter $id is implicitly treated as a required parameter

Enabling the module on CLI with brush is giving:

The following extensions will be enabled: bueditor
Do you really want to continue? (y/n): y
PHP Deprecated:  Optional parameter $bids declared before required parameter $id is implicitly treated as a required parameter in /var/www/html/docroot/modules/contrib/bueditor/admin/bueditor.admin.inc on line 521

Deprecated: Optional parameter $bids declared before required parameter $id is implicitly treated as a required parameter in /var/www/html/docroot/modules/contrib/bueditor/admin/bueditor.admin.inc on line 521
PHP Deprecated:  Optional parameter $bids declared before required parameter $id is implicitly treated as a required parameter in /var/www/html/docroot/modules/contrib/bueditor/admin/bueditor.admin.inc on line 537

Deprecated: Optional parameter $bids declared before required parameter $id is implicitly treated as a required parameter in /var/www/html/docroot/modules/contrib/bueditor/admin/bueditor.admin.inc on line 537
PHP Deprecated:  Optional parameter $bids declared before required parameter $id is implicitly treated as a required parameter in /var/www/html/docroot/modules/contrib/bueditor/admin/bueditor.admin.inc on line 1021

Deprecated: Optional parameter $bids declared before required parameter $id is implicitly treated as a required parameter in /var/www/html/docroot/modules/contrib/bueditor/admin/bueditor.admin.inc on line 1021

on a system with PHP version:

PHP 8.1.22 (cli) (built: Aug 29 2023 10:48:28) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.22, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.22, Copyright (c), by Zend Technologies

Convert bueditor tables into config

Bueditor stores editors and buttons in tables and has it's own unique way of exporting and importing them. I wonder how much trouble it would be to convert those to use config?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.