当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript document.querySelector方法代码示例

本文整理汇总了TypeScript中@ephox/dom-globals.document.querySelector方法的典型用法代码示例。如果您正苦于以下问题:TypeScript document.querySelector方法的具体用法?TypeScript document.querySelector怎么用?TypeScript document.querySelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ephox/dom-globals.document的用法示例。


在下文中一共展示了document.querySelector方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

export default function () {
  const textarea = document.createElement('textarea');
  textarea.innerHTML = '<p>Bolt</p>';

  textarea.classList.add('tinymce');
  document.querySelector('#ephox-ui').appendChild(textarea);

  tinymce.init({
    // imagetools_cors_hosts: ["moxiecode.cachefly.net"],
    // imagetools_proxy: "proxy.php",
    // imagetools_api_key: '123',

    // images_upload_url: 'postAcceptor.php',
    // images_upload_base_path: 'base/path',
    // images_upload_credentials: true,
    skin_url: '../../../../js/tinymce/skins/ui/oxide',
    setup (ed) {
      ed.addButton('demoButton', {
        type: 'button',
        text: 'Demo',
        onclick () {
          ed.insertContent('Hello world!');
        }
      });
    },

    selector: 'textarea.tinymce',
    toolbar1: 'demoButton bold italic',
    menubar: false
  });
}
开发者ID:tinymce,项目名称:tinymce,代码行数:31,代码来源:TinyMceDemo.ts

示例2: function

 ], function (notification) {
   const btn = document.createElement('button');
   btn.innerHTML = notification.title;
   btn.onclick = function () {
     notification.action(notification.value);
   };
   document.querySelector('#ephox-ui').appendChild(btn);
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:NotificationDemo.ts

示例3: function

 Arr.each(commands, function (cmd) {
   const btn = document.createElement('button');
   btn.innerHTML = cmd.command;
   btn.onclick = function () {
     tinymce.activeEditor.execCommand(cmd.command, false, cmd.value);
   };
   document.querySelector('#ephox-ui').appendChild(btn);
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:CommandsDemo.ts

示例4: function

export default function () {
  const textarea = document.createElement('textarea');
  textarea.rows = 20;
  textarea.cols = 80;
  textarea.innerHTML = '<p>Bolt</p>';
  textarea.classList.add('tinymce');
  document.querySelector('#ephox-ui').appendChild(textarea);

  tinymce.init({
    selector: 'textarea',
    theme (editor, target) {
      const dom = tinymce.DOM;
      let editorContainer;

      editorContainer = dom.insertAfter(dom.create('div', { style: 'border: 1px solid gray' },
        '<div>' +
        '<button data-mce-command="bold">B</button>' +
        '<button data-mce-command="italic">I</button>' +
        '<button data-mce-command="mceInsertContent" data-mce-value="Hello">Insert Hello</button>' +
        '</div>' +
        '<div style="border-top: 1px solid gray"></div>'
      ), target);

      dom.setStyle(editorContainer, 'width', target.offsetWidth);

      tinymce.each(dom.select('button', editorContainer), function (button) {
        dom.bind(button, 'click', function (e) {
          e.preventDefault();

          editor.execCommand(
            dom.getAttrib(e.target, 'data-mce-command'),
            false,
            dom.getAttrib(e.target, 'data-mce-value')
          );
        });
      });

      editor.on(function () {
        tinymce.each(dom.select('button', editorContainer), function (button) {
          editor.formatter.formatChanged(dom.getAttrib(button, 'data-mce-command'), function (state) {
            button.style.color = state ? 'red' : '';
          });
        });
      });

      return {
        editorContainer,
        iframeContainer: editorContainer.lastChild,
        iframeHeight: target.offsetHeight - editorContainer.firstChild.offsetHeight
      };
    },
    height: 600
  });
}
开发者ID:tinymce,项目名称:tinymce,代码行数:54,代码来源:CustomThemeDemo.ts

示例5:

 Step.sync(() => {
   const body = document.querySelector('.tox-dialog__body');
   Assertions.assertStructure('A basic confirm dialog should have these components',
     ApproxStructure.build((s, str, arr) => {
       return s.element('div', {
         classes: [ arr.has('tox-dialog__body')],
         children: [
           s.element('p', {
             html: str.is(label)
           })
         ]
       });
     }),
     SugarElement.fromDom(body)
   );
 }),
开发者ID:tinymce,项目名称:tinymce,代码行数:16,代码来源:WindowManagerConfirmTest.ts

示例6:

/**
 * Demo.js
 *
 * Released under LGPL License.
 * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
 *
 * License: http://www.tinymce.com/license
 * Contributing: http://www.tinymce.com/contributing
 */

import { document } from '@ephox/dom-globals';

declare let tinymce: any;

const element: any = document.querySelector('.tinymce');
element.value = '<table><tbody><tr><td>One</td></tr></tbody></table>';

tinymce.init({
  selector: 'textarea.tinymce',
  theme: 'modern',
  skin_url: '../../../../../js/tinymce/skins/lightgray',
  plugins: 'table colorpicker code',
  toolbar: 'table code',
  height: 600
});

export {};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:27,代码来源:Demo.ts

示例7:

 const sRemoveTestDiv = Step.sync(() => {
   const input = document.querySelector('#' + testDivId);
   input.parentNode.removeChild(input);
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:4,代码来源:GetSelectionContentTest.ts

示例8: function

import { document } from '@ephox/dom-globals';

declare let tinymce: any;

const button = document.querySelector('button.clicky');
button.addEventListener('click', function () {
  tinymce.activeEditor.insertContent(content);
});
const content = '<span class="mceNonEditable">[NONEDITABLE]</span>';
const button2 = document.querySelector('button.boldy');
button2.addEventListener('click', function () {
  tinymce.activeEditor.execCommand('bold');
});

tinymce.init({
  selector: 'div.tinymce',
  theme: 'silver',
  inline: true,
  skin_url: '../../../../../js/tinymce/skins/ui/oxide',
  plugins: 'noneditable code',
  toolbar: 'code',
  height: 600
});

tinymce.init({
  selector: 'textarea.tinymce',
  theme: 'silver',
  skin_url: '../../../../../js/tinymce/skins/ui/oxide',
  plugins: 'noneditable code',
  toolbar: 'code',
  height: 600
开发者ID:tinymce,项目名称:tinymce,代码行数:31,代码来源:Demo.ts

示例9:

 return Logger.t('Add anchor' + text, Step.sync(function () {
   const elm: any = document.querySelector('div[role="dialog"].tox-dialog  input');
   elm.value = text;
 }));
开发者ID:tinymce,项目名称:tinymce,代码行数:4,代码来源:AnchorSanityTest.ts


注:本文中的@ephox/dom-globals.document.querySelector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。