Get started with KEditor, the jQuery plugin which provides a content editor with drag n drop, configurable contents.
- jQuery for DOM stuffs such as traversing, manipulation, utilities, etc...
- jQuery UI for sortable and resizable stuffs
- jQuery Fullscreen for fullscreen mode
- FontAwesome for icons
- Bootstrap for content styles (optional)
There are 2 ways to initialize KEditor:
-
Via jQuery plugin. Examples:
$('.selector').keditor({ // options });
-
Via
init
method. Examples:KEditor.init($('.selector'), { // options });
Note: For options, please view at here for all configuration options
keditor
├───content-area
│ ├───container
│ │ ├───container-content
│ │ │ ├───component
│ │ │ ├───sub-container
│ │ │ │ │───sub-container-content
│ │ │ │ │ │───component
│ │ │ │ │ │───component
│ │ │ │ │ └───...
│ │ │ │ └───...
│ │ │ └───...
│ │ └───...
│ └───...
└───...
Details:
- Each
keditor
will havecontent-area
(s) as children - Each
content-area
will havecontainer
(s) as children - Each
container
will havecontainer-content
(s) as children - Each
container-content
will havesub-container
(s) orcomponent
as children - Each
sub-container
will havesub-container-content
(s) as children - Each
sub-container-content
will havecomponent
as children
All content of KEditor will be editing inside iframe
. Reason for it:
- Independent styles with editor controls
- Can change devices width when editing and previewing
There are 2 ways to specify stylesheet for iframe:
-
Via
data-type=keditor-style
. KEditor will usehref
ordata-href
for external styles andinnerHTML
for internal styles. Examples:<!-- This style will be applied for both current document and iframe --> <link rel="stylesheet" data-type="keditor-style" type="text/css" href="/path/to/first/css" /> <!-- This style will be applied for both current document and iframe --> <style data-type="keditor-style" type="text/css"> /* CSS rules */ </style> <!-- This style will not impact to current document --> <div data-type="keditor-style" data-href="/path/to/second/css"></div> <!-- This style will not impact to current document --> <script data-type="keditor-style" data-href="/path/to/third/css"></script> <!-- This style will not impact to current document --> <script data-type="keditor-style"> // CSS rules </script>
-
Via
contentStyles
option. Examples:$('.selector').keditor({ contentStyles: [ { id: 'firstStyle', href: '/path/to/first/css' }, { id: 'secondStyle', content: 'a { color: red; }' } ] });