How to use medium - 10 common examples

To help you get started, we’ve selected a few medium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github researchstudio-sat / webofneeds / webofneeds / won-owner-webapp / src / main / webapp / app / components / need-textfield.js View on Github external
initMedium() {
      // initialising editor. see http://jakiestfu.github.io/Medium.js/docs/
      this.medium = new Medium({
        element: this.mediumMount(),

        modifier: "auto",
        placeholder:
          "What? - Short title shown in lists <br> Longer description. You can use #tags",
        autoHR: false, //if true, inserts <hr> after two empty lines
        mode: Medium.partialMode, // allows newlines, no styling
        attributes: {
          //remove: ['style', 'class'] //TODO does this remove the ng-class?
          remove: ["style"], //TODO does this remove the ng-class?
        },
        beforeInsertHtml: function() {
          //this = Medium.Html (!)

          // Replace `<br>`s with the `<p>`s we use for line-breaking, to allow
          // multi-line pasting. This assumes that pasting happens inside</p>
github researchstudio-sat / webofneeds / webofneeds / won-owner-webapp / src / main / webapp / app / components / chat-textfield.js View on Github external
initMedium() {
            // initialising editor. see http://jakiestfu.github.io/Medium.js/docs/
            this.medium = new Medium({
                element: this.mediumMount(),

                modifier: 'auto',

                placeholder: is('String', this.placeholder) ?
                    // make sure we've got a string to avoid errors internal to medium.js
                    this.placeholder : "",

                autoHR: false, //if true, inserts <hr> after two empty lines
                mode: Medium.inlineMode, // no newlines, no styling
                //mode: Medium.partialMode, // allows newlines, no styling
                //maxLength: this.maxChars, // -1 would disable it
                tags: {
                    /*
                     'break': 'br',
                     'horizontalRule': 'hr',
github researchstudio-sat / webofneeds / webofneeds / won-owner-webapp / src / main / webapp / app / components / chat-textfield.js View on Github external
initMedium() {
            // initialising editor. see http://jakiestfu.github.io/Medium.js/docs/
            this.medium = new Medium({
                element: this.mediumMount(),

                modifier: 'auto',

                placeholder: is('String', this.placeholder) ?
                    // make sure we've got a string to avoid errors internal to medium.js
                    this.placeholder : "",

                autoHR: false, //if true, inserts <hr> after two empty lines
                mode: Medium.inlineMode, // no newlines, no styling
                //mode: Medium.partialMode, // allows newlines, no styling
                //maxLength: this.maxChars, // -1 would disable it
                tags: {
                    /*
                     'break': 'br',
                     'horizontalRule': 'hr',
                     'paragraph': 'p',
                     'outerLevel': ['pre', 'blockquote', 'figure'],
                     'innerLevel': ['a', 'b', 'u', 'i', 'img', 'strong']
                     */
                },
                attributes: {
                    //remove: ['style', 'class'] //TODO does this remove the ng-class?
                    remove: ['style'] //TODO does this remove the ng-class?
                },
            });
github researchstudio-sat / webofneeds / webofneeds / won-owner-webapp / src / main / webapp / app / components / need-textfield.js View on Github external
initMedium() {
      // initialising editor. see http://jakiestfu.github.io/Medium.js/docs/
      this.medium = new Medium({
        element: this.mediumMount(),

        modifier: "auto",
        placeholder:
          "What? - Short title shown in lists <br> Longer description. You can use #tags",
        autoHR: false, //if true, inserts <hr> after two empty lines
        mode: Medium.partialMode, // allows newlines, no styling
        attributes: {
          //remove: ['style', 'class'] //TODO does this remove the ng-class?
          remove: ["style"], //TODO does this remove the ng-class?
        },
        beforeInsertHtml: function() {
          //this = Medium.Html (!)

          // Replace `<br>`s with the `<p>`s we use for line-breaking, to allow
          // multi-line pasting. This assumes that pasting happens inside
          // a `</p><p>` element and will horribly fail otherwise.
          // The trimming happens, as leading whitespaces are removed in other
          // lines as well during pasting.
          const originalHtml = this.html;
          const sanitizedHtml = originalHtml.trim().replace(/<br>/g, "</p><p>");
          this.html = sanitizedHtml;
</p>
github oreqizer / redux-forms / packages / redux-forms / src / __tests__ / arrays.spec.ts View on Github external
it('should shift nested array', () => {
    const res = arrayUnshift('medium.0.nest', 2)(fields);

    expect(res['medium.0.nest.2']).toBeUndefined();

    expect(res['medium.0.nest.0']).toBe(field0);
    expect(res['medium.0.nest.1']).toBe(field1);
    expect(res['medium.0.nest.3']).toBe(field2);
    expect(res['medium.0.nest.4']).toBe(field3);
  });
github oreqizer / redux-forms / packages / redux-forms / src / __tests__ / arrays.spec.ts View on Github external
it('should swap nested fields', () => {
    const res = arraySwap('medium', 0, 1)(fields);

    expect(res['medium.0.nest.0']).toBe(fields['medium.1.nest.0']);
    expect(res['medium.0.nest.1']).toBe(fields['medium.1.nest.1']);
    expect(res['medium.0.nest.2']).toBe(fields['medium.1.nest.2']);
    expect(res['medium.0.nest.3']).toBe(fields['medium.1.nest.3']);

    expect(res['medium.1.nest.0']).toBe(fields['medium.0.nest.0']);
    expect(res['medium.1.nest.1']).toBe(fields['medium.0.nest.1']);
    expect(res['medium.1.nest.2']).toBe(fields['medium.0.nest.2']);
    expect(res['medium.1.nest.3']).toBe(fields['medium.0.nest.3']);
  });
github oreqizer / redux-forms / packages / redux-forms / src / __tests__ / arrays.spec.ts View on Github external
it('should swap nested fields', () => {
    const res = arraySwap('medium', 0, 1)(fields);

    expect(res['medium.0.nest.0']).toBe(fields['medium.1.nest.0']);
    expect(res['medium.0.nest.1']).toBe(fields['medium.1.nest.1']);
    expect(res['medium.0.nest.2']).toBe(fields['medium.1.nest.2']);
    expect(res['medium.0.nest.3']).toBe(fields['medium.1.nest.3']);

    expect(res['medium.1.nest.0']).toBe(fields['medium.0.nest.0']);
    expect(res['medium.1.nest.1']).toBe(fields['medium.0.nest.1']);
    expect(res['medium.1.nest.2']).toBe(fields['medium.0.nest.2']);
    expect(res['medium.1.nest.3']).toBe(fields['medium.0.nest.3']);
  });
github oreqizer / redux-forms / packages / redux-forms / src / __tests__ / arrays.spec.ts View on Github external
it('should swap nested fields', () => {
    const res = arraySwap('medium', 0, 1)(fields);

    expect(res['medium.0.nest.0']).toBe(fields['medium.1.nest.0']);
    expect(res['medium.0.nest.1']).toBe(fields['medium.1.nest.1']);
    expect(res['medium.0.nest.2']).toBe(fields['medium.1.nest.2']);
    expect(res['medium.0.nest.3']).toBe(fields['medium.1.nest.3']);

    expect(res['medium.1.nest.0']).toBe(fields['medium.0.nest.0']);
    expect(res['medium.1.nest.1']).toBe(fields['medium.0.nest.1']);
    expect(res['medium.1.nest.2']).toBe(fields['medium.0.nest.2']);
    expect(res['medium.1.nest.3']).toBe(fields['medium.0.nest.3']);
  });
github oreqizer / redux-forms / packages / redux-forms / src / __tests__ / arrays.spec.ts View on Github external
it('should shift nested array', () => {
    const res = arrayUnshift('medium.0.nest', 2)(fields);

    expect(res['medium.0.nest.2']).toBeUndefined();

    expect(res['medium.0.nest.0']).toBe(field0);
    expect(res['medium.0.nest.1']).toBe(field1);
    expect(res['medium.0.nest.3']).toBe(field2);
    expect(res['medium.0.nest.4']).toBe(field3);
  });
github oreqizer / redux-forms / packages / redux-forms / src / __tests__ / arrays.spec.ts View on Github external
it('should swap nested fields', () => {
    const res = arraySwap('medium', 0, 1)(fields);

    expect(res['medium.0.nest.0']).toBe(fields['medium.1.nest.0']);
    expect(res['medium.0.nest.1']).toBe(fields['medium.1.nest.1']);
    expect(res['medium.0.nest.2']).toBe(fields['medium.1.nest.2']);
    expect(res['medium.0.nest.3']).toBe(fields['medium.1.nest.3']);

    expect(res['medium.1.nest.0']).toBe(fields['medium.0.nest.0']);
    expect(res['medium.1.nest.1']).toBe(fields['medium.0.nest.1']);
    expect(res['medium.1.nest.2']).toBe(fields['medium.0.nest.2']);
    expect(res['medium.1.nest.3']).toBe(fields['medium.0.nest.3']);
  });