Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Latest version not replacing url on resolve of image uploader

オープン
#413 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
angular, typescript
領域
frontend

調査の方向性

Start with the image uploader callback shown in the issue and compare the earlier success/failure handler with the newer Promise-based handler. Verify how the resolved URL is consumed by the TinyMCE Angular integration, using the logged response URL and the hard-coded resolved URL as test cases. Done means the uploaded image URL is placed in the editor after the Promise resolves.

索引モデルが issue の本文から書いたものです。

説明

the below function was working fine

function (blobInfo, success, failure) {
const xhr = new XMLHttpRequest();
xhr.open('POST', ${environment.SITE_BASE_URL}filemanager/filemanager/upload.php);
xhr.onload = function () {
if (xhr.status !== 200) {
failure('HTTP Error: ' + xhr.status);
return;
}
const json = JSON.parse(xhr.responseText);
if (!json?.files[0]?.url) {
failure('Invalid JSON: ' + xhr.responseText);
return;
}
success(json?.files[0]?.url);
};
xhr.onerror = function () {
failure('Image upload failed due to a XHR error');
};

    const formData = new FormData();
    formData.append('files[]', blobInfo.blob(), blobInfo.filename());
    formData.append('fldr', '');
    xhr.withCredentials = true;
    xhr.send(formData);
  }

In latest version I replace the above with below

(blobInfo, progress) => new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open('POST', ${environment.SITE_BASE_URL}filemanager/filemanager/upload.php);

      xhr.onload = () => {
        if (xhr.status !== 200) {
          reject('HTTP Error: ' + xhr.status);
          return;
        }

        const json = JSON.parse(xhr.responseText);
        console.log(json);
        if (!json?.files[0]?.url) {
          reject('Invalid JSON: ' + xhr.responseText);
          return;
        }

        console.log(json?.files[0]?.url);
        resolve('https://apiss.kualiteestaging.com/files/mceclip1.png');
      };

      xhr.onerror = (error) => {
        console.log(error);
        reject('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);
      };

      const formData = new FormData();
      formData.append('fldr', '');
      formData.append('files[]', blobInfo.blob(), blobInfo.filename());

      xhr.send(formData);
    })

but on resolving the url is not getting placed but it was happening with first version. Is I am doing something wrong or missing or its abug

主要言語
TypeScript
スター
346
フォーク
94
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tinymce/tinymce-angular のほかの issue

tinymce/tinymce-angular の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。