Comments (1)
Hi, thanks for getting in touch!
A bit of explanation:
By default, the CKEditor field stores data in the database as HTML. When you import your data via Feed Me, it gets saved in the database as is. So if you import # this is an h1 heading
, it is stored as that exact string.
You then load the editor page with the CKEditor field, and the CKEditor converts the data to a model and view. The model is what CKEditor understands and uses to work with the data; the view is the actual HTML you see (and with the HTML data processor, it’s that HTML that gets stored in the database).
So when it loads the # this is an h1 heading
string, the model looks like this:
<$root>
<paragraph>
# this is an h1 heading
</paragraph>
</$root>
Which is downcasted to a view of:
<p># this is an h1 heading</p>
When you then manipulate the view in the editor, remove the space after #
and add it back in, CKEditor understands that this is Markdown (even without the plugin I mention later on) and upcasts to a model that looks like this:
<$root>
<heading1>
this is an h1 heading
</heading1>
</$root>
With a corresponding view of:
<h1>this is an h1 heading</h1>
Changing data processor:
CKEditor has a Markdown plugin, which isn’t included in the Craft’s implementation of the editor, but you could add it yourself: https://github.com/craftcms/ckeditor#adding-ckeditor-plugins. The field’s content would then be stored in the database as Markdown. Please note that as per the plugin’s page, Markdown doesn’t support all the rich text features, and there are known issues with this plugin. Also, you’ll have to think about rendering the content in the front end. With the Markdown plugin, it will be stored in the database as markdown, so you’d have to parse it (e.g. via the |markdown
filter).
I hope this helps!
from ckeditor.
Related Issues (20)
- CraftCMS 5[alpha] - Query selector error for nested entry type HOT 1
- Suggestion: Migration script should name the configs, not use 0-based indexing HOT 2
- Migration script missed a field named "disclaimer" on two separate sites inside a Matrix block HOT 2
- [4.0.0-beta.1] "New Entry" flow allows switching to unpermitted entry types within slideout HOT 1
- [4.0.0-beta.1] Select existing entry?
- Error after 3.7.2: cannot read properties of undefined (reading 'registerChildCommand') HOT 6
- Richtext Editor missing after Update to version 3.7.2 HOT 2
- [4.0.0-beta.4] GQL isn't working? HOT 7
- [5.x]: CKEditor fields not displayed in elements-index HOT 1
- Multiple warnings in console after updates Craft CMS 4.7.3 and CKEditor 3.7.3 HOT 2
- Anchor Links option not available HOT 1
- Live preview is not triggered when using panel features HOT 4
- Adding id attribute to text or headings
- Twig Runtime Error – Twig\Error\RuntimeError Calling unknown method: craft\ckeditor\CkeConfig::listPlugin() HOT 3
- Link option "Link to an asset" is missing when CKEditor field is in a matrix block. HOT 3
- [4.0] Unable to initialize field without Element HOT 2
- Styles dropdown preview broken HOT 1
- [4.x] New Entry dropdown defaults to alphabetical ordering instead of the order set in field settings HOT 2
- [4.x] Editing copy/pasted embed entries will edit both the original and copied entry HOT 3
- Element without getFieldLayout results in an error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ckeditor.