Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change default target for all links #841

Closed
robsilva opened this issue May 10, 2022 · 1 comment
Closed

change default target for all links #841

robsilva opened this issue May 10, 2022 · 1 comment

Comments

@robsilva
Copy link

I have been looking through the documentation and I am unable to find a way to make all link targets open in a new tab.
Is there a config parameter for that? The closest I got was to override the link template in the config object.
I tried manually setting the input for "target" to checked and value="true", but the link inserted still opens in the same window.

    link: {
      formTemplate: (editor) => {
        const i18n = editor.i18n.bind(editor);

        return `
          <form class="jodit-ui-form" dir="auto">
            <div class="jodit-ui-block jodit-ui-block_align_left jodit-ui-block_size_middle">
                <div class="jodit-ui-input jodit-ui-block__url">
                  <span class="jodit-ui-input__label">URL</span>
                  <div class="jodit-ui-input__wrapper">
                      <input class="jodit-ui-input__input" dir="auto" name="url" type="text" data-ref="url_input" ref="url_input" required="true" placeholder="http://">
                  </div>
                </div>
            </div>
            <div class="jodit-ui-block jodit-ui-block_align_left jodit-ui-block_size_middle" data-ref="content_input_box" ref="content_input_box">
                <div class="jodit-ui-input jodit-ui-block__content">
                  <span class="jodit-ui-input__label">Text</span>
                  <div class="jodit-ui-input__wrapper">
                      <input class="jodit-ui-input__input" dir="auto" name="content" type="text" data-ref="content_input" ref="content_input" placeholder="">
                    </div>
                </div>
            </div>
            <div class="jodit-ui-block jodit-ui-block_align_left jodit-ui-block_size_middle">
                <div class="jodit-ui-input jodit-ui-block__className">
                  <span class="jodit-ui-input__label">Class name</span>
                  <div class="jodit-ui-input__wrapper">
                      <input class="jodit-ui-input__input" dir="auto" name="className" type="text" data-ref="className_input" ref="className_input" placeholder="">
                    </div>
                </div>
            </div>
            <label class="jodit-ui-checkbox jodit-ui-checkbox_checked_false jodit-ui-checkbox_switch_false jodit-ui-form__target">
                <span class="jodit-ui-checkbox__label">Open in new tab</span>
                <div class="jodit-ui-checkbox__wrapper">
                  <input class="jodit-ui-checkbox__input" dir="auto" name="target" type="checkbox" data-ref="target_checkbox" ref="target_checkbox" placeholder="" value="true" checked>
                </div>
            </label>
            <label class="jodit-ui-checkbox jodit-ui-checkbox_checked_false jodit-ui-checkbox_switch_false jodit-ui-form__nofollow">
                <span class="jodit-ui-checkbox__label">No follow</span>
                <div class="jodit-ui-checkbox__wrapper">
                  <input class="jodit-ui-checkbox__input" dir="auto" name="nofollow" type="checkbox" data-ref="nofollow_checkbox" ref="nofollow_checkbox" placeholder="" value="false">
                </div>
            </label>
            <div class="jodit-ui-block jodit-ui-block_align_full jodit-ui-block_size_middle">
                <button class="jodit-ui-button jodit-ui-button_size_middle jodit-ui-button_unlink jodit-ui-button_variant_default jodit-ui-button_text-icons_true jodit-ui-block__unlink" type="button" role="button" aria-pressed="false" data-ref="unlink" ref="unlink" style="display: none;"><span class="jodit-ui-button__icon"></span><span class="jodit-ui-button__text">Unlink</span></button><button class="jodit-ui-button jodit-ui-button_size_middle jodit-ui-button_insert jodit-ui-button_variant_primary jodit-ui-button_text-icons_true jodit-ui-block__insert" type="submit" role="button" aria-pressed="false" data-ref="insert" ref="insert"><span class="jodit-ui-button__icon"></span><span class="jodit-ui-button__text">Insert</span></button>
              </div>
          </form>
        `;
      },
    },
xdan added a commit that referenced this issue May 10, 2022
change default target for all links #841
Issue: #841
@xdan
Copy link
Owner

xdan commented May 11, 2022

Added an event for your task. See how it was done in the autotest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants