how to import the other temples in the imgly project for ReactJs

I encountered some errors while trying to import additional templates into the Img.ly project. Despite my efforts, I haven’t been able to resolve the issue on my own. Below is a snippet of the code I am using:

` useEffect(() => {
/** @type {import(“@cesdk/engine”).Configuration} */

const config = {
  locale: "en",
  theme: "light",
  license:
    "license-key",
  i18n: {
    en: {
      "libraries.ly.img.audio.ly.img.audio.label": "Soundstripe",
      ...pageFormatI18n(PAGE_FORMAT_ASSETS.assets),
      "libraries.ly.img.video.templates.label": "Example Templates",
    },
  },
  ui: {
    pageFormats: formatAssetsToPresets(PAGE_FORMAT_ASSETS),
    elements: {
      view: "advanced",
      panels: {
        inspector: {
          show: true,
          position: "right",
        },
        settings: true,
      },
      dock: {
        iconSize: "normal",
        hideLabels: false,
        groups: [
          {
            id: "my-templates-group",
            entryIds: ["my-templates-entry"],
          },
          {
            id: "misc",
            entryIds: ["pageFormats"],
          },
          {
            id: "examples",
            entryIds: ["ly.img.video.templates"],
          },
          {
            id: "ly.img.defaultGroup",
            showOverview: true,
          },
        ],
      },
      navigation: {
        action: {
          export: {
            show: true,
            format: ["image/png", "application/pdf"],
          },
        },
      },
      libraries: {
        insert: {
          entries: (defaultEntries) => {
            return [
              ...defaultEntries,
              PAGE_FORMATS_INSERT_ENTRY,
              {
                id: "ly.img.video.templates",
                sourceIds: ["ly.img.video.templates"],
                icon: () => caseAssetPath("/static-video-scenes-icon.svg"),
              },
            ];
          },
        },
      },
      navigation: {
        position: UserInterfaceElements.NavigationPosition.Top,
        action: {
          save: true,
          load: true,
          download: true,
          export: true,
        },
      },
    },
  },
  callbacks: {
    onUpload: "local",
    onSave: (scene) => {
      const element = document.createElement("a");
      const base64Data = btoa(unescape(encodeURIComponent(scene)));
      element.setAttribute(
        "href",
        `data:application/octet-stream;base64,${base64Data}`
      );
      element.setAttribute(
        "download",
        `cesdk-${new Date().toISOString()}.scene`
      );
      element.style.display = "none";
      document.body.appendChild(element);
      element.click();
      document.body.removeChild(element);
    },
    onLoad: async (file) => {
      const reader = new FileReader();
      reader.onload = async (e) => {
        if (typeof e.target.result !== "string") {
          console.error(
            "Expected a string, but received:",
            e.target.result
          );
          return; // Early exit if the result is not a string
        }

        const scene = e.target.result;
        if (!scene) {
          console.error("No valid scene content found.");
          return; // Exit the callback early
        }
        await cesdkRef.current.loadFromString(scene);
      };

      reader.onerror = (error) => {
        console.error("File reading error:", error);
      };
      reader.readAsText(file);
    },
    onDownload: "download",
    onExport: "download",
  },
};

let cesdk;

if (cesdk_container.current) {
  CreativeEditorSDK.create(cesdk_container.current, config).then(
    async (instance) => {
      instance.addDefaultAssetSources();
      instance.addDemoAssetSources({
        sceneMode: "Video",
        excludeAssetSourceIds: ["ly.img.audio"],
      });

      cesdk = instance;
      cesdkRef.current = instance;
      cesdk.engine.editor.setSettingBool("page/title/show", false);
      const scene = await cesdk.createVideoScene();

      loadTemplates(instance);

      // Check if the scene block supports blur before applying it
      const blockType = cesdk.engine.block.getType(scene);
      if (blockType === "image" || blockType === "video") {
        // Apply blur or other effects
        cesdk.engine.block.setBlur(scene, { amount: 10 }); // Example blur application
      } else {
        console.warn("The block type does not support blur.");
      }

      loadAssetSourceFromContentJSON(
        cesdk.engine,
        VIDEO_SCENES_ASSETS,
        caseAssetPath("/templates"),
        createDefaultApplyAssetScene(cesdk.engine)
      );
      loadAssetSourceFromContentJSON(
        cesdk.engine,
        AUDIO_ASSETS,
        caseAssetPath("/audio")
      );
      loadAssetSourceFromContentJSON(
        cesdk.engine,
        PAGE_FORMAT_ASSETS,
        caseAssetPath("/page-formats"),
        createApplyFormatAsset(cesdk.engine)
      );

      try {
        cesdk
          .loadFromURL(caseAssetPath(selectedTemplates))
          .catch((error) => {
            console.error("Failed to load template:", error);
          });
      } catch (error) {
        console.error("Error loading template:", error);
      }
    }
  );
}
return () => {
  if (cesdk) {
    cesdk.dispose();
  }
};

}, [cesdk_container, selectedTemplates]);
`

“I am attempting to resolve this issue by inspecting the onLoad and navigation sections:

navigation: { position: UserInterfaceElements.NavigationPosition.Top, action: { save: true, load: true, download: true, export: true, }, }, I aim to import and save the template files accordingly.”

New contributor

Arjun Bhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật