Commit 3ae49ac3 authored by Dallas Reedy's avatar Dallas Reedy Committed by Kushal Pandya

Remove usage of underscore; replace with native JS

* Use jQuery’s `makeArray` to convert jQuery wrapped collection to native array
* Use native `Array.prototype.map` and `.some`
* Create an `isEmpty` util which is identical in behavior to underscore and lodash
parent 612f82a1
/* eslint-disable class-methods-use-this */
import { Mark } from 'tiptap';
import _ from 'underscore';
import { escape as esc } from 'lodash';
// Transforms generated HTML back to GFM for Banzai::Filter::MarkdownFilter
export default class InlineHTML extends Mark {
......@@ -35,7 +35,7 @@ export default class InlineHTML extends Mark {
mixable: true,
open(state, mark) {
return `<${mark.attrs.tag}${
mark.attrs.title ? ` title="${state.esc(_.escape(mark.attrs.title))}"` : ''
mark.attrs.title ? ` title="${state.esc(esc(mark.attrs.title))}"` : ''
}>`;
},
close(state, mark) {
......
import $ from 'jquery';
import _ from 'underscore';
import { isEmpty } from 'lodash';
import '../commons/bootstrap';
// Requires Input behavior
......@@ -23,10 +23,10 @@ $.fn.requiresInput = function requiresInput() {
function requireInput() {
// Collect the input values of *all* required fields
const values = _.map($(fieldSelector, $form), field => field.value);
const values = Array.from($(fieldSelector, $form)).map(field => field.value);
// Disable the button if any required fields are empty
if (values.length && _.some(values, _.isEmpty)) {
if (values.length && values.some(isEmpty)) {
$button.disable();
} else {
$button.enable();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment