@bigbinary/neeto-editor-frontend
v2.2.4
Published
neetoEditor is the library that drives the rich text experience in all neeto products built at BigBinary
Readme
NeetoEditorNano
The neetoEditor nano consists of:
neeto-editor-engine: A Ruby gem that manages the asset uploads in neetoEditor. Each uploaded asset will be associated with an organization. Besides managing assets it does a few other things too.@bigbinary/neeto-editor-frontend: The library that drives the rich text experience in the neeto products built at BigBinary.
Contents
Installation
Backend
- Add the following line to your application's Gemfile:
source "NEETO_GEM_SERVER_URL" do
# ..existing gems
gem "neeto-editor-engine"
end- Execute the following command:
bundle install- Add the following line to
config/routes.rbfile to mount the engine at/neeto_editorroute.
mount NeetoEditorEngine::Engine, at: "/neeto_editor"- Add the following line to
models/organization.rbfile.
has_many :neeto_editor_assets, class_name: "NeetoEditorEngine::Asset", dependent: :destroy- Execute the following command to generate the migration to generate the
neeto_editor_engine_assetstable.
rails g neeto_editor_engine:install:migrations- Run migrations.
rails db:migrateFrontend
yarn add @bigbinary/neeto-editor-frontendFor setting up image upload refer https://neeto-editor.neeto.com/?path=/docs/examples-customize-options-addons--addons.
Usage
Utils
trim_empty_lines: This util is added to theStringclass. It will help you to remove leading and trailing empty lines.str = "<p></p><h1></h1><br><h1>Hello world</h1><h1></h1><span></span>" str.trim_empty_lines # <h1>Hello world</h1>sanitize: Sanitizes editor HTML for safe server-side rendering. UsesRails::HTML::PermitScrubberwith an allowlist of tags and attributes matching the editor's output. Preserves CSS variables (--custom-propertyandvar()) and validates iframesrcdomains (YouTube, Vimeo, Loom, NeetoRecord, SupaDemo).NeetoEditorEngine.sanitize(html)
Instructions for development
Install all the dependencies by executing the following command.
yarnRunning the yarn storybook command starts a storybook application. Use this
application to test out changes.
When developing frontend packages, it's crucial to test changes in a live environment using a host application. There are two ways to do this:
Using yalc package manager: https://youtu.be/F4zZFnrNTq8
Directly updating the node_modules of the host application.
Start the host application server.
Inside the package, execute the command:
yarn build --watch --app ../neeto-site-webHere replace
../neeto-site-webwith path to the host project. Now, any changes made to the neetoEditor codebase will be instantly reflected in the UI.Run the following command in the host application to reset to the initial state.
yarn install --check-files
Instructions for Publishing
Consult the building and releasing packages guide for details on how to publish.
Documentation
Read the frontend docs here: https://neeto-editor.neeto.com.
