nodebb-plugin-tenor-gif 2.2.0 → 3.0.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/library.js CHANGED
@@ -84,6 +84,7 @@ plugin.query = async (query) => {
84
84
  memo.push({
85
85
  url: cur.media_formats.gif.url,
86
86
  thumb: cur.media_formats.tinygif.url,
87
+ alt: cur.content_description,
87
88
  });
88
89
 
89
90
  return memo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-tenor-gif",
3
- "version": "2.2.0",
3
+ "version": "3.0.0",
4
4
  "description": "",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "readmeFilename": "README.md",
23
23
  "nbbpm": {
24
- "compatibility": "^2.4.0"
24
+ "compatibility": "^3.0.0"
25
25
  },
26
26
  "dependencies": {
27
27
  "@commitlint/cli": "^9.1.2",
package/plugin.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "id": "nodebb-plugin-tenor-gif",
3
3
  "url": "https://github.com/NodeBB/nodebb-plugin-tenor-gif",
4
- "library": "./library.js",
5
4
  "hooks": [
6
5
  { "hook": "static:app.load", "method": "init" },
7
6
  { "hook": "filter:admin.header.build", "method": "addAdminNavigation" },
@@ -13,8 +12,8 @@
13
12
  "modules": {
14
13
  "../admin/plugins/tenor-gif.js": "static/lib/admin.js"
15
14
  },
16
- "less": [
17
- "static/less/modal.less"
15
+ "scss": [
16
+ "static/scss/modal.scss"
18
17
  ],
19
18
  "templates": "static/templates"
20
19
  }
@@ -24,8 +24,8 @@ $(document).ready(function () {
24
24
  ], function (formatting, controls) {
25
25
  if (formatting && controls) {
26
26
  formatting.addButtonDispatch('gif', function (textarea, selectionStart, selectionEnd) {
27
- Tenor.showModal(function (url, query) {
28
- Tenor.select(textarea, selectionStart, selectionEnd, url, query);
27
+ Tenor.showModal(function (url, query, alt) {
28
+ Tenor.select(textarea, selectionStart, selectionEnd, url, query, alt);
29
29
  });
30
30
  });
31
31
  }
@@ -103,7 +103,7 @@ $(document).ready(function () {
103
103
  });
104
104
 
105
105
  resultsEl.on('click', 'img[data-url]', function () {
106
- callback(this.getAttribute('data-url'), queryEl.val());
106
+ callback(this.getAttribute('data-url'), queryEl.val(), this.getAttribute('alt'));
107
107
  modal.modal('hide');
108
108
  });
109
109
 
@@ -113,15 +113,15 @@ $(document).ready(function () {
113
113
  });
114
114
  };
115
115
 
116
- Tenor.select = function (textarea, selectionStart, selectionEnd, url, query) {
116
+ Tenor.select = function (textarea, selectionStart, selectionEnd, url, query, alt) {
117
117
  require([
118
118
  'composer/formatting',
119
119
  'composer/controls',
120
120
  ], function (formatting, controls) {
121
121
  if (selectionStart === selectionEnd) {
122
- controls.insertIntoTextarea(textarea, '![' + query + '](' + url + ')');
122
+ controls.insertIntoTextarea(textarea, '![' + alt + '](' + url + ')');
123
123
  controls.updateTextareaSelection(
124
- textarea, selectionStart + query.length + 4, selectionEnd + query.length + url.length + 4
124
+ textarea, selectionStart + alt.length + 4, selectionEnd + alt.length + url.length + 4
125
125
  );
126
126
  } else {
127
127
  var wrapDelta = controls.wrapSelectionInTextareaWith(textarea, '![', '](' + url + ')');
@@ -19,12 +19,12 @@
19
19
  /* Composer formatting icon override */
20
20
  .fa-tenor-gif::before {
21
21
  content: 'GIF';
22
- font-size: 1rem;
22
+ font-size: calc($font-size-base / 2);
23
23
  font-family: sans;
24
24
  background: #333;
25
25
  color: #fff;
26
26
  padding: 0.25rem 0.5rem;
27
27
  border-radius: 0.5em;
28
28
  position: relative;
29
- top: -0.2rem;
29
+ top: -0.15rem;
30
30
  }
@@ -1,18 +1,18 @@
1
1
  <form role="form" class="tenor-gif-settings">
2
2
  <div class="row">
3
- <div class="col-sm-2 col-xs-12 settings-header">General</div>
4
- <div class="col-sm-10 col-xs-12">
3
+ <div class="col-sm-2 col-12 settings-header">General</div>
4
+ <div class="col-sm-10 col-12">
5
5
  <p class="lead">
6
6
  Sign up for your Tenor GIF API Key from the <a href="https://console.cloud.google.com/apis/credentials">Google Cloud Console</a>, then enter it below and reload your NodeBB.
7
7
  </p>
8
8
  <p>
9
9
  <strong>Be careful</strong>: If you use the <i class="fa fa-copy"></i> button to copy the API key, it'll add spaces to the beginning and end. You'll need to remove those.
10
10
  </p>
11
- <div class="form-group">
11
+ <div class="mb-3">
12
12
  <label for="key">API Key</label>
13
13
  <input type="text" id="key" name="key" title="API Key" class="form-control" placeholder="API Key">
14
14
  </div>
15
- <div class="form-group">
15
+ <div class="mb-3">
16
16
  <label for="contentFilter">Content Filter</label>
17
17
  <select class="form-control" id="contentFilter" name="contentFilter">
18
18
  <option value="off">Off</option>
@@ -21,7 +21,7 @@
21
21
  <option value="high">High</option>
22
22
  </select>
23
23
  </div>
24
- <div class="form-group">
24
+ <div class="mb-3">
25
25
  <label for="limit">Limit results</label>
26
26
  <input class="form-control" type="number" min="1" max="50" id="limit" placeholder="10" name="limit" />
27
27
  </div>
@@ -1 +1 @@
1
- <!-- BEGIN gifs --><img data-url="{../url}" src="{../thumb}" /><!-- END -->
1
+ <!-- BEGIN gifs --><img data-url="{../url}" src="{../thumb}" alt="{../alt}" /><!-- END -->
@@ -1,4 +1,4 @@
1
- <div class="form-group">
1
+ <div class="mb-3">
2
2
  <input type="text" id="gif-query" class="form-control">
3
3
  <div id="gif-results"></div>
4
4
  </div>