@blocklet/pages-kit 0.4.131 → 0.4.133

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,7 +68,7 @@ function injectGlobalComponents() {
68
68
  if (win[builtin_1.BuiltinModulesGlobalVariableName]) {
69
69
  return;
70
70
  }
71
- const enableShim = !!window?.esmsInitOptions?.shimMode && win.importShim;
71
+ const enableShim = !!win?.esmsInitOptions?.shimMode && win.importShim;
72
72
  if (!enableShim && win.importShim?.addImportMap) {
73
73
  win.importShim.addImportMap = () => {
74
74
  // avoid addImportMap error
@@ -252,17 +252,21 @@ export default ${hasDefaultExport ? 'moduleSource.default' : 'moduleSource'};
252
252
  }
253
253
  // 添加 resolve 配置
254
254
  const importMap = { imports };
255
- if (enableShim) {
256
- window.importShim.addImportMap(importMap);
257
- }
258
- else {
259
- // fallback to create script tag
260
- const script = document.createElement('script');
261
- script.type = 'importmap';
262
- script.textContent = JSON.stringify(importMap, null, 2);
263
- document.head.appendChild(script);
264
- }
265
255
  win.importMap = importMap;
256
+ if (enableShim && !!window?.esmsInitOptions?.shimMode) {
257
+ try {
258
+ win.importShim.addImportMap(importMap);
259
+ return;
260
+ }
261
+ catch (error) {
262
+ // ignore error
263
+ }
264
+ }
265
+ // fallback to create script tag
266
+ const script = document.createElement('script');
267
+ script.type = 'importmap';
268
+ script.textContent = JSON.stringify(importMap, null, 2);
269
+ document.head.appendChild(script);
266
270
  };
267
271
  setupImportMap();
268
272
  }
@@ -12,12 +12,13 @@ const matchLanguage = (className) => {
12
12
  const match = /language-(\w+)/.exec(className || '');
13
13
  return match?.[1];
14
14
  };
15
- function MarkdownCode({ node, inline, className, children, ...props }) {
15
+ function MarkdownCode({ node, className, children, ...props }) {
16
16
  const { codeOptions } = useMarkdownOptions();
17
17
  if (!children)
18
18
  return null;
19
+ const inline = node?.position?.start?.line === node?.position?.end?.line;
19
20
  const language = matchLanguage(className);
20
- return !inline ? (_jsx(Box, { component: ReactSyntaxHighlighter, language: language, style: codeOptions?.theme, showLineNumbers: true, ...props, sx: { borderRadius: 1 }, children: String(children).replace(/\n$/, '') })) : (_jsx(Box, { component: "code", className: className, ...props, children: children }));
21
+ return !inline ? (_jsx(Box, { component: ReactSyntaxHighlighter, language: language, style: codeOptions?.theme, showLineNumbers: true, ...props, sx: { borderRadius: 1 }, children: String(children).replace(/\n$/, '') })) : (_jsx(Box, { component: "code", className: className, ...props, sx: { backgroundColor: '#EEEEEE', borderRadius: 1, p: 0.5, ...(props.sx ?? {}) }, children: children }));
21
22
  }
22
23
  function MarkdownTable({ className, children }) {
23
24
  return (_jsx(Box, { sx: { overflow: 'auto', my: 1 }, children: _jsx("table", { className: className, children: children }) }));