web/static-dist/libs/es-ckeditor/plugins/pasteimage/plugin-debug.js

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
respository: https://github.com/bellorchid/pasteimage
*/
'use strict';

(function () {
  CKEDITOR.plugins.add('pasteimage', {
    lang: 'en,zh,zh-cn',
    requires: 'uploadwidget',

    onLoad: function () {
      CKEDITOR.addCss(
        '.cke_upload_uploading img{' +
        'opacity: 0.3' +
        '}'
      );
    },

    init: function (editor) {
      CKEDITOR.scriptLoader.load(CKEDITOR.getUrl('plugins/pasteimage/filesize.js'));
      // Do not execute this paste listener if it will not be possible to upload file.
      if (!CKEDITOR.plugins.clipboard.isFileApiSupported) {
        return;
      }

      var fileTools = CKEDITOR.fileTools,
        uploadUrl = fileTools.getUploadUrl(editor.config, 'image') || '';

      if (!uploadUrl) {
        return;
      }

      // Handle images which are available in the dataTransfer.
      fileTools.addUploadWidget(editor, 'pasteimage', {
        supportedTypes: /image\/(jpeg|png|gif|bmp)/,

        uploadUrl: uploadUrl,

        fileToElement: function () {
          var img = new CKEDITOR.dom.element('img');
          img.setAttribute('src', loadingImage);
          return img;
        },

        parts: {
          img: 'img'
        },

        onUploading: function (upload) {
          // Show the image during the upload.
          this.parts.img.setAttribute('src', upload.data);
        },

        onUploaded: function (upload) {
          // Width and height could be returned by server (http://dev.ckeditor.com/ticket/13519).
          var $img = this.parts.img.$;

          // Set width and height to prevent blinking.
          this.replaceWith( '<img src="' + upload.url + '" ' + '">' );
        }

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。