nodebb-plugin-composer-default 9.0.0 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-composer-default",
3
- "version": "9.0.0",
3
+ "version": "9.1.0",
4
4
  "description": "Default composer for NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -29,6 +29,9 @@
29
29
  "compatibility": "^2.5.0"
30
30
  },
31
31
  "dependencies": {
32
+ "@textcomplete/contenteditable": "^0.1.12",
33
+ "@textcomplete/core": "^0.1.12",
34
+ "@textcomplete/textarea": "^0.1.12",
32
35
  "screenfull": "^5.0.2",
33
36
  "validator": "^13.7.0"
34
37
  },
@@ -570,3 +570,4 @@
570
570
 
571
571
  @import './zen-mode.less';
572
572
  @import './page-compose.less';
573
+ @import './textcomplete.less';
@@ -0,0 +1,24 @@
1
+ .textcomplete-dropdown {
2
+ border: 1px solid #ddd;
3
+ background-color: white;
4
+ list-style: none;
5
+ padding: 0;
6
+ margin: 0;
7
+
8
+ li {
9
+ margin: 0;
10
+ }
11
+
12
+ .textcomplete-footer, .textcomplete-item {
13
+ border-top: 1px solid #ddd;
14
+ }
15
+
16
+ .textcomplete-item {
17
+ padding: 2px 5px;
18
+ cursor: pointer;
19
+
20
+ &:hover, &.active {
21
+ background-color: rgb(110, 183, 219);
22
+ }
23
+ }
24
+ }
@@ -65,23 +65,23 @@ define('composer/autocomplete', [
65
65
  };
66
66
 
67
67
  // This is a generic method that is also used by the chat
68
- autocomplete.setup = function (data) {
69
- var element = data.element.get(0);
70
- if (!element) {
68
+ autocomplete.setup = function ({ element, strategies, options }) {
69
+ const targetEl = element.get(0);
70
+ if (!targetEl) {
71
71
  return;
72
72
  }
73
73
  var editor;
74
- if (element.nodeName === 'TEXTAREA') {
75
- editor = new TextareaEditor(element);
76
- } else if (element.nodeName === 'DIV' && element.getAttribute('contenteditable') === 'true') {
77
- editor = new ContenteditableEditor(element);
74
+ if (targetEl.nodeName === 'TEXTAREA') {
75
+ editor = new TextareaEditor(targetEl);
76
+ } else if (targetEl.nodeName === 'DIV' && targetEl.getAttribute('contenteditable') === 'true') {
77
+ editor = new ContenteditableEditor(targetEl);
78
78
  }
79
79
 
80
80
  // yuku-t/textcomplete inherits directionality from target element itself
81
- element.setAttribute('dir', document.querySelector('html').getAttribute('data-dir'));
81
+ targetEl.setAttribute('dir', document.querySelector('html').getAttribute('data-dir'));
82
82
 
83
- var textcomplete = new Textcomplete(editor, data.strategies, {
84
- dropdown: data.options,
83
+ var textcomplete = new Textcomplete(editor, strategies, {
84
+ dropdown: options,
85
85
  });
86
86
  textcomplete.on('rendered', function () {
87
87
  if (textcomplete.dropdown.items.length) {