Skip to content

Commit 048a602

Browse files
committed
Add files, update gitignore
1 parent acf718b commit 048a602

File tree

71 files changed

+11657
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+11657
-62
lines changed

.gitignore

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,3 @@
1-
# gitignore template for Drupal 8 projects
2-
#
3-
# earlier versions of Drupal are tracked in `community/PHP/`
4-
#
5-
# follows official upstream conventions:
6-
# https://www.drupal.org/docs/develop/using-composer
7-
8-
# Ignore configuration files that may contain sensitive information
9-
/web/sites/*/*settings*.php
10-
/web/sites/*/*services*.yml
11-
12-
# Ignore paths that may contain user-generated content
13-
/web/sites/*/files
14-
/web/sites/*/public
15-
/web/sites/*/private
16-
/web/sites/*/files-public
17-
/web/sites/*/files-private
18-
19-
# Ignore paths that may contain temporary files
20-
/web/sites/*/translations
21-
/web/sites/*/tmp
22-
/web/sites/*/cache
23-
24-
# Ignore drupal core (if not versioning drupal sources)
25-
/web/vendor
26-
/web/core
27-
/web/modules/README.txt
28-
/web/profiles/README.txt
29-
/web/sites/development.services.yml
30-
/web/sites/example.settings.local.php
31-
/web/sites/example.sites.php
32-
/web/sites/README.txt
33-
/web/themes/README.txt
34-
/web/.csslintrc
35-
/web/.editorconfig
36-
/web/.eslintignore
37-
/web/.eslintrc.json
38-
/web/.gitattributes
39-
/web/.htaccess
40-
/web/.ht.router.php
41-
/web/autoload.php
42-
/web/composer.json
43-
/web/composer.lock
44-
/web/example.gitignore
45-
/web/index.php
46-
/web/INSTALL.txt
47-
/web/LICENSE.txt
48-
/web/README.txt
49-
/web/robots.txt
50-
/web/update.php
51-
/web/web.config
52-
53-
# Ignore vendor dependencies and scripts
54-
/vendor
55-
/composer.phar
56-
/composer
57-
/robo.phar
58-
/robo
59-
/drush.phar
60-
/drush
61-
/drupal.phar
62-
/drupal
1+
node_modules
2+
.DS_Store
3+
.parcel-cache

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# apsc_ckeditor_widgets
2+
A Drupal module to add some common widgets to CKeditor
3+
4+
## Working with the javascript
5+
6+
Plugin source should be added to
7+
`js/ckeditor5_plugins/{pluginNameDirectory}/src` and the build tools expect this
8+
directory to include an `index.js` file that exports one or more CKEditor 5
9+
plugins. Note that requiring `index.js` to be inside
10+
`{pluginNameDirectory}/src` is not a fixed requirement of CKEditor 5 or Drupal,
11+
but a requirement of this starter template that can be changed in
12+
`webpack.config.js` as needed.
13+
14+
In the module directory, run `yarn install` to set up the necessary assets. The
15+
initial run of `install` may take a few minutes, but subsequent builds will be
16+
faster.
17+
18+
After installing dependencies, plugins can be built with `yarn build` or `yarn
19+
watch`. They will be built to `js/build/{pluginNameDirectory}.js`. co
20+
21+
## CKEditor API
22+
- v4: https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html
23+
- custom widget example:
24+
- https://ckeditor.com/docs/ckeditor4/latest/examples/simplebox.html
25+
- v5: https://ckeditor.com/docs/ckeditor5/latest/api/index.html
26+
- plugin examples:
27+
- https://ckeditor.com/docs/ckeditor5/latest/framework/guides/plugins/creating-simple-plugin-timestamp.html
28+
- https://ckeditor.com/docs/ckeditor5/latest/framework/guides/tutorials/implementing-a-block-widget.html
29+
30+
## Drupal resources
31+
- Dev Tools for CKE5 - https://www.drupal.org/project/ckeditor5_dev
32+
- CKE5 Drupal API - https://www.drupal.org/docs/drupal-apis/ckeditor-5-api/overview
33+
- Development guide - https://www.drupal.org/docs/core-modules-and-themes/core-modules/ckeditor-5-module/ckeditor-5-development
34+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# If using yml to configure plugins, rename this to {module_name}.ckeditor5.yml.
2+
# If using annotations, this file can be removed.
3+
# @see https://www.drupal.org/docs/drupal-apis/plugin-api/annotations-based-plugins
4+
# For information on using annotations to define plugins.
5+
# @see the CKEditor 5 module's README.md for more details regarding plugin
6+
# configuration options.
7+
8+
apsc_ckeditor_widgets_apsccolorbox:
9+
ckeditor5:
10+
plugins:
11+
- apscColorBox.ApscColorBox
12+
config:
13+
apscColorBox:
14+
contentToolbar:
15+
- 'apscColorBoxAlignExpanded'
16+
- 'apscColorBoxAlignFull'
17+
- 'apscColorBoxAlignLeft'
18+
- 'apscColorBoxAlignCenter'
19+
- 'apscColorBoxAlignRight'
20+
- '|'
21+
- 'apscColorBoxPaddingOptions'
22+
- '|'
23+
- 'apscColorBoxMarginOptions'
24+
- '|'
25+
- 'apscColorBoxBackgroundOptions'
26+
- '|'
27+
- 'apscColorBoxShadowToggle'
28+
drupal:
29+
label: Color Box
30+
library: apsc_ckeditor_widgets/apsc_color_box
31+
admin_library: apsc_ckeditor_widgets/apsc_color_box.admin
32+
toolbar_items:
33+
ApscColorBox:
34+
label: APSC Color Box
35+
elements:
36+
- <div>
37+
- <div class>
38+
39+
apsc_ckeditor_widgets_dividedcolumns:
40+
ckeditor5:
41+
plugins:
42+
- apscDividedColumns.ApscDividedColumns
43+
drupal:
44+
label: Divided Columns
45+
library: apsc_ckeditor_widgets/apsc_divided_columns
46+
admin_library: apsc_ckeditor_widgets/apsc_divided_columns.admin
47+
toolbar_items:
48+
ApscDividedColumns:
49+
label: Divided Columns
50+
elements:
51+
- <div>
52+
- <div class>
53+
54+
apsc_ckeditor_widgets_expand:
55+
ckeditor5:
56+
plugins:
57+
- apscExpand.ApscExpand
58+
drupal:
59+
label: Expand Region
60+
library: apsc_ckeditor_widgets/apsc_expand
61+
admin_library: apsc_ckeditor_widgets/apsc_expand.admin
62+
toolbar_items:
63+
ApscExpand:
64+
label: Expand Region
65+
elements:
66+
- <div>
67+
- <div class>

apsc_ckeditor_widgets.info.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This has 'change-this-to-info' in the filename instead of 'info' so this
2+
name: APSC CKEditor Widgets
3+
type: module
4+
description: "Adds wysiwyg buttons and functions for CKEditor"
5+
package: CKEditor 5
6+
core_version_requirement: ^9 || ^10
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This adds the plugin JavaScript to the page.
2+
3+
# Add all required styles and JS to the public facing site
4+
apsc_ckeditor_widgets.ui:
5+
css:
6+
theme:
7+
css/bg.color.css: { }
8+
css/drop.shadow.css: {}
9+
css/m.css: { }
10+
css/p.css: { }
11+
css/apsc.widget.default.styles.css: { }
12+
dependencies:
13+
- core/drupal
14+
- core/drupalSettings
15+
- core/once
16+
17+
# Color Box
18+
apsc_color_box:
19+
css:
20+
theme:
21+
css/apsc.color.box.css: { }
22+
js:
23+
js/build/apscColorBox.js: { preprocess: false, minified: true }
24+
dependencies:
25+
- core/ckeditor5
26+
27+
apsc_color_box.admin:
28+
css:
29+
theme:
30+
css/apsc.color.box.admin.css: { }
31+
32+
# Divided Columns
33+
apsc_divided_columns:
34+
css:
35+
theme:
36+
css/apsc.divided.columns.css: { }
37+
js:
38+
js/build/apscDividedColumns.js: { preprocess: false, minified: true }
39+
dependencies:
40+
- core/ckeditor5
41+
42+
apsc_divided_columns.admin:
43+
css:
44+
theme:
45+
css/apsc.divided.columns.admin.css: { }
46+
47+
# Expand Region
48+
apsc_expand:
49+
css:
50+
theme:
51+
css/apsc.expand.css: { }
52+
js:
53+
js/build/apscExpand.js: { preprocess: false, minified: true }
54+
dependencies:
55+
- core/ckeditor5
56+
57+
apsc_expand.admin:
58+
css:
59+
theme:
60+
css/apsc.expand.admin.css: { }

apsc_ckeditor_widgets.module

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Contains apsc_ckeditor_widgets.module.
6+
*/
7+
8+
/**
9+
* Implements hook_page_attachments_alter().
10+
*/
11+
function apsc_ckeditor_widgets_page_attachments_alter(array &$page) {
12+
// Attaches css assets globally.
13+
$page['#attached']['library'][] = 'apsc_ckeditor_widgets/apsc_ckeditor_widgets.ui';
14+
}

composer.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "ubc-web-services/apsc_ckeditor_widgets",
3+
"description": "A Drupal module to add some common widgets to CKeditor",
4+
"type": "drupal-module",
5+
"authors": [{
6+
"name": "O'Toole, James",
7+
"email": "[email protected]"
8+
}],
9+
"require": {}
10+
}

css/apsc.color.box.admin.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ckeditor5-toolbar-button-ApscColorBox {
2+
background-image: url(../icons/apscColorBox.svg);
3+
}

css/apsc.color.box.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* Editor-specific styles */
2+
.widget-color-box.ck-widget {
3+
position: relative;
4+
}
5+
6+
.widget-color-box.ck-widget::after {
7+
position: absolute;
8+
top: 0;
9+
right: 1rem;
10+
content: 'Color Box';
11+
background-color: #ccc;
12+
color: #111;
13+
padding: .5em;
14+
font-size: .5rem;
15+
}
16+
17+
/* Color Box */
18+
.widget-color-box {
19+
min-width: 10rem;
20+
}

css/apsc.divided.columns.admin.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.ckeditor5-toolbar-button-ApscDividedColumns {
2+
background-image: url(../icons/addKeyline.svg);
3+
}

0 commit comments

Comments
 (0)