Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

iframe being rendered strangely in the canvas view

Đang mở
#37 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Tái hiện hành vi của iframe trong bản demo chính thức bằng một khối mã tùy chỉnh, sau đó so sánh chế độ xem canvas với modal View code và editor.getHtml(). Theo dõi vị trí canvas thay thế iframe bằng một div và di chuyển các thuộc tính của nó; hoàn thành khi canvas giữ nguyên bố cục của iframe và vẫn nhất quán với đầu ra của model.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hello,

The issue described below can be reproduced on the official demo at https://grapesjs.com/demo.html

When I try to add an iframe in a custom code block, the view tends to replace the iframe by a div, which breaks the layout of the iframe. However, the model seems to have the correct iframe since it is shown correctly in the view code modal, or by using editor.getHtml().

For example, if I add this iframe which is an embed YouTube video:

<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?si=m6l8dvLYog_PS9a4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

This is what the canvas view will use, parts of the iframe attributes are now on a parent div:

<div data-gjs-highlightable="true" id="i73h" data-gjs-type="custom-code" draggable="true">
  <div id="i5xd" data-gjs-type="video" draggable="true" allowfullscreen="" width="560" height="315" src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?si=m6l8dvLYog_PS9a4" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" class="gjs-hovered">
    <iframe src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?" frameborder="0" allowfullscreen="true" class="gjs-no-pointer" style="height: 100%; width: 100%;"></iframe>
  </div>
</div>
Ngôn ngữ chính
TypeScript
Star
81
Fork
47
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của GrapesJS/components-custom-code

Tất cả issue của GrapesJS/components-custom-code

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.