This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 132
Switch to CKEditor #394
Merged
Merged
Switch to CKEditor #394
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
ad83da0
Initial implementation of the ckeditor for Notes
cedricium b172ba4
Removed commented lines regarding Quill
cedricium 3cf3a30
Enabled footer buttons functionality
cedricium d7d0c01
Added additional formats to be used by ckeditor
cedricium 0b48d6c
(Tried) Building Classic editor from source
cedricium 5d458ed
Clean up and custom build
vladikoff f741d04
More editor cleanup, fix up css
vladikoff eac7966
clean up link balloon a bit
vladikoff 540d03f
Update note logic for ckeditor
vladikoff 39f8c30
Make dark theme almost work
vladikoff 099c2b9
Add migration script, fix Welcome text
vladikoff 397b9cb
Add missing dependencies.
3b90966
Add getPadStats for CKEditor.
ee5445e
Fix travis config.
9468be3
Add ENV variables to give context.
8f05954
Fix linter errors.
fd35054
Add strike plugin
Natim af4ee36
Dark Theme touchups
cedricium cf24be2
Merge pull request #399 from cedricium/ckeditor-concept
Natim a628561
Use P rather than 14.
ea52ec6
Merge pull request #400 from mozilla/natim-wording
Natim 7b9c1d6
Merge branch 'master' of https://github.com/mozilla/notes into ckedit…
cedricium 1f56f65
Merge branch 'ckeditor-concept' of https://github.com/mozilla/notes i…
cedricium b798eb5
Fix text cursor, update deps
vladikoff 8445529
Fix right click on toolbars, Fix tooltips
vladikoff b0d6c29
Add comment for fixed bug
vladikoff 5df24a1
Fix typo
vladikoff 911b86b
Patch out heading until it is fixed upstream
vladikoff 46921a1
Merge branch 'master' into ckeditor-concept
vladikoff ff5ce1b
Use new strike icon
vladikoff fdacfce
Add ordered list styles, add heading
vladikoff 1794eaa
Update deps, remove extra focs
vladikoff f9cd3af
Fit icons into single row with the default sidebar width
vladikoff b599f90
Remove extra console statement
vladikoff 38d6060
CSS Tweaks
vladikoff 5b8b640
* Fix button localization
vladikoff 911fb87
Fix too much space between rows
vladikoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ src/vendor/* | |
src/sidebar/vendor/* | ||
src/_locales | ||
web-ext-artifacts/ | ||
ckeditor-build/build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; | ||
import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials'; | ||
import MarkdownPlugin from './markdown'; | ||
import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat/src/autoformat'; | ||
import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold'; | ||
import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic'; | ||
import StrikePlugin from './strike'; | ||
import CodePlugin from '@ckeditor/ckeditor5-basic-styles/src/code'; | ||
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading'; | ||
import ListPlugin from '@ckeditor/ckeditor5-list/src/list'; | ||
import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph'; | ||
import Range from '@ckeditor/ckeditor5-engine/src/model/range'; | ||
|
||
export default class ClassicEditor extends ClassicEditorBase {} | ||
|
||
ClassicEditor.build = { | ||
plugins: [ | ||
EssentialsPlugin, | ||
MarkdownPlugin, | ||
AutoformatPlugin, | ||
BoldPlugin, | ||
ItalicPlugin, | ||
StrikePlugin, | ||
CodePlugin, | ||
HeadingPlugin, | ||
ListPlugin, | ||
ParagraphPlugin | ||
], | ||
config: { | ||
toolbar: { | ||
items: [ | ||
'headings', | ||
'bulletedList', | ||
'numberedList', | ||
'bold', | ||
'italic', | ||
'strike', | ||
'code' | ||
] | ||
} | ||
} | ||
}; | ||
|
||
ClassicEditor.imports = { range: Range }; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import GFMDataProcessor from '@ckeditor/ckeditor5-markdown-gfm/src/gfmdataprocessor'; | ||
|
||
// Simple plugin which loads the data processor. | ||
export default function Markdown(editor) { | ||
editor.data.processor = new GFMDataProcessor(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* @license Copyright (c) 2017, CKSource - Rémy Hubscher. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/** | ||
* @module notes/ckeditor-build/strike | ||
*/ | ||
|
||
import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; | ||
import StrikeEngine from './strikeengine'; | ||
import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview'; | ||
import strikeIcon from './icons/strike.svg'; | ||
|
||
/** | ||
* The strike feature. It introduces the Strike button and the <kbd>Ctrl+Alt+S</kbd> keystroke. | ||
* | ||
* It uses the {@link module:basic-styles/strikeengine~StrikeEngine strike engine feature}. | ||
* | ||
* @extends module:core/plugin~Plugin | ||
*/ | ||
export default class Strike extends Plugin { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
static get requires() { | ||
return [ StrikeEngine ]; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
static get pluginName() { | ||
return 'Strike'; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
init() { | ||
const editor = this.editor; | ||
const t = editor.t; | ||
const command = editor.commands.get( 'strike' ); | ||
|
||
// Add strike button to feature components. | ||
editor.ui.componentFactory.add( 'strike', locale => { | ||
const view = new ButtonView( locale ); | ||
|
||
view.set( { | ||
label: t( 'Strike' ), | ||
icon: strikeIcon, | ||
tooltip: true | ||
} ); | ||
|
||
view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' ); | ||
|
||
// Execute command. | ||
this.listenTo( view, 'execute', () => editor.execute( 'strike' ) ); | ||
|
||
return view; | ||
} ); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* @license Copyright (c) 2017, CKSource - Rémy Hubscher. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/** | ||
* @module notes/ckeditor-build/strikeengine | ||
*/ | ||
|
||
import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; | ||
import buildModelConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildmodelconverter'; | ||
import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildviewconverter'; | ||
import AttributeCommand from '@ckeditor/ckeditor5-basic-styles/src/attributecommand'; | ||
|
||
const STRIKE = 'strike'; | ||
|
||
/** | ||
* The strike engine feature. | ||
* | ||
* It registers the `strike` command and introduces the | ||
* `strikesthrough` attribute in the model which renders to the view | ||
* as a `<s>` element. | ||
* | ||
* @extends module:core/plugin~Plugin | ||
*/ | ||
export default class StrikeEngine extends Plugin { | ||
/** | ||
* @inheritDoc | ||
*/ | ||
init() { | ||
const editor = this.editor; | ||
const data = editor.data; | ||
const editing = editor.editing; | ||
|
||
// Allow strike attribute on all inline nodes. | ||
editor.document.schema.allow( { name: '$inline', attributes: STRIKE, inside: '$block' } ); | ||
// Temporary workaround. See https://github.com/ckeditor/ckeditor5/issues/477. | ||
editor.document.schema.allow( { name: '$inline', attributes: STRIKE, inside: '$clipboardHolder' } ); | ||
|
||
// Build converter from model to view for data and editing pipelines. | ||
buildModelConverter().for( data.modelToView, editing.modelToView ) | ||
.fromAttribute( STRIKE ) | ||
.toElement( 's' ); | ||
|
||
// Build converter from view to model for data pipeline. | ||
buildViewConverter().for( data.viewToModel ) | ||
.fromElement( 's' ) | ||
.fromElement( 'del' ) | ||
.fromElement( 'strike' ) | ||
.fromAttribute( 'style', { 'text-decoration': 'line-through' } ) | ||
.toAttribute( STRIKE, true ); | ||
|
||
// Create strike command. | ||
editor.commands.add( STRIKE, new AttributeCommand( editor, STRIKE ) ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
/* eslint-env node */ | ||
|
||
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const {bundler} = require('@ckeditor/ckeditor5-dev-utils'); | ||
const CKEditorWebpackPlugin = require('@ckeditor/ckeditor5-dev-webpack-plugin'); | ||
const BabiliPlugin = require('babel-minify-webpack-plugin'); | ||
|
||
module.exports = { | ||
devtool: 'source-map', | ||
|
||
entry: path.resolve(__dirname, 'src', 'ckeditor.js'), | ||
|
||
output: { | ||
// build to the extension src vendor directory | ||
path: path.resolve(__dirname, '..', 'src', 'sidebar', 'vendor'), | ||
filename: 'ckeditor.js', | ||
libraryTarget: 'umd', | ||
libraryExport: 'default', | ||
library: 'ClassicEditor' | ||
}, | ||
|
||
plugins: [ | ||
new CKEditorWebpackPlugin({ | ||
languages: ['en'] | ||
}), | ||
new BabiliPlugin(null, { | ||
comments: false | ||
}), | ||
new webpack.BannerPlugin({ | ||
banner: bundler.getLicenseBanner(), | ||
raw: true | ||
}) | ||
], | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.svg$/, | ||
use: ['raw-loader'] | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
use: [ | ||
'style-loader', | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
minimize: true | ||
} | ||
}, | ||
'sass-loader' | ||
] | ||
} | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍