Skip to content

Commit c42dd3b

Browse files
Merge pull request #2311 from syncfusion-content/EJ2-1010807-staging-errors
1010807: Resolved staging errors respect to styles in react
2 parents b090655 + 4f5a017 commit c42dd3b

3 files changed

Lines changed: 73 additions & 50 deletions

File tree

Document-Processing/PDF/PDF-Viewer/react/context-menu/custom-context-menu.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ You can add custom options to the context menu using the [addCustomMenu()](https
2222
2. Call the [`addCustomMenu`](https://ej2.syncfusion.com/react/documentation/api/pdfviewer#addcustommenu) method within the [`documentLoad`](https://ej2.syncfusion.com/react/documentation/api/pdfviewer#documentload) event handler.
2323

2424
```js
25-
export function App() {
26-
25+
export function App() {
2726
let menuItems = [
2827
{
2928
text: 'Search In Google',
@@ -55,7 +54,6 @@ You can add custom options to the context menu using the [addCustomMenu()](https
5554
var viewer = document.getElementById('container').ej2_instances[0];
5655
viewer.addCustomMenu(menuItems, false);
5756
}
58-
5957
return (
6058
<div>
6159
<div className='control-section'>
@@ -223,19 +221,13 @@ The following is the output of the custom context menu with customization.
223221

224222
{% tabs %}
225223
{% highlight js tabtitle="index.jsx" %}
226-
{% raw %}
227224
{% include code-snippet/pdfviewer/react/custom-context-menu/app/index.jsx %}
228-
{% endraw %}
229225
{% endhighlight %}
230226
{% highlight ts tabtitle="index.tsx" %}
231-
{% raw %}
232227
{% include code-snippet/pdfviewer/react/custom-context-menu/app/index.tsx %}
233-
{% endraw %}
234228
{% endhighlight %}
235229
{% endtabs %}
236230

237231
N> To set up the **server-backed PDF Viewer**, add the following `serviceUrl` within the <div> element in either the `index.TSX` or `index.JSX` file: **serviceUrl="https://document.syncfusion.com/web-services/pdf-viewer/api/pdfviewer"**.
238232

239-
{% previewsample "document-processing/code-snippet/pdfviewer/react/custom-context-menu" %}
240-
241233
[View the sample in Stack blitz](https://stackblitz.com/edit/react-zmbkebwq?file=index.js)

Document-Processing/PDF/PDF-Viewer/react/how-to/existing-react-layout.md

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
2121

2222
Basic div:
2323

24-
```ts
25-
// App.tsx
24+
{% tabs %}
25+
{% highlight ts tabtitle="App.tsx" %}
26+
{% raw %}
2627
import React from 'react';
2728
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, Annotation, TextSearch, FormFields, FormDesigner, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';
2829

@@ -40,13 +41,17 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
4041
</div>
4142
);
4243
}
43-
```
44+
{% endraw %}
45+
{% endhighlight %}
46+
{% endtabs %}
47+
4448
![PDF Viewer in div](../images/react-layouts-div.png)
4549

4650
Flex container: keep `minHeight: 0` on flex children so the viewer can shrink/grow correctly:
4751

48-
```ts
49-
// App.tsx
52+
{% tabs %}
53+
{% highlight ts tabtitle="App.tsx" %}
54+
{% raw %}
5055
import React from 'react';
5156
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, Annotation, TextSearch, FormFields, FormDesigner, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';
5257

@@ -69,13 +74,17 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
6974
</div>
7075
);
7176
}
72-
```
77+
{% endraw %}
78+
{% endhighlight %}
79+
{% endtabs %}
80+
7381
![PDF Viewer in Flex box](../images/react-layouts-flexbox.png)
7482

7583
CSS Grid - reserve rows/columns using `grid-template-rows` or `grid-template-columns`:
7684

77-
```ts
78-
// App.tsx
85+
{% tabs %}
86+
{% highlight ts tabtitle="App.tsx" %}
87+
{% raw %}
7988
import React from 'react';
8089
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormDesigner, FormFields, Inject } from '@syncfusion/ej2-react-pdfviewer';
8190

@@ -151,14 +160,18 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
151160
minHeight: 0 // critical so the viewer can grow/shrink
152161
}
153162
};
154-
```
163+
{% endraw %}
164+
{% endhighlight %}
165+
{% endtabs %}
166+
155167
![PDF Viewer in grid](../images/react-layouts-grid.png)
156168

157169
- **Use viewer inside Tab components**
158170
- The react PDF Viewer are also supported inside Syncfusion tab components.
159171

160-
```ts
161-
// App.tsx
172+
{% tabs %}
173+
{% highlight ts tabtitle="App.tsx" %}
174+
{% raw %}
162175
import React, { useRef } from 'react';
163176
import { TabComponent, TabItemsDirective, TabItemDirective } from '@syncfusion/ej2-react-navigations';
164177
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, TextSearch, Annotation, FormDesigner, FormFields, Inject } from '@syncfusion/ej2-react-pdfviewer';
@@ -224,14 +237,18 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
224237
</div>
225238
);
226239
};
227-
```
240+
{% endraw %}
241+
{% endhighlight %}
242+
{% endtabs %}
243+
228244
![PDF Viewer in tab](../images/react-layouts-tab.png)
229245

230246
- **Use viewer inside Dialog**
231247
- If the viewer sits inside a dialog, for example Syncfusion Dialog, render or initialize the viewer after the dialog open events. The DOM must be visible for the viewer to measure layout.
232248

233-
```ts
234-
// App.tsx
249+
{% tabs %}
250+
{% highlight ts tabtitle="App.tsx" %}
251+
{% raw %}
235252
import React, { useRef, useCallback } from 'react';
236253
import { DialogComponent } from '@syncfusion/ej2-react-popups';
237254
import {
@@ -295,14 +312,18 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
295312
</div>
296313
);
297314
};
298-
```
315+
{% endraw %}
316+
{% endhighlight %}
317+
{% endtabs %}
318+
299319
![PDF Viewer in dialog](../images/react-layouts-dialog.png)
300320

301321
- **Use viewer inside Collapsible sections**
302322
- For accordions or collapsible containers, either render the viewer lazily when the section expands or dispatch the resize event after expansion so the viewer can recompute layout.
303323

304-
```ts
305-
// App.tsx
324+
{% tabs %}
325+
{% highlight ts tabtitle="App.tsx" %}
326+
{% raw %}
306327
import React, { useCallback, useRef } from 'react';
307328
import {
308329
AccordionComponent, AccordionItemsDirective, AccordionItemDirective, ExpandEventArgs
@@ -382,9 +403,10 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
382403
</div>
383404
);
384405
};
385-
```
386-
```css
387-
/* App.css */
406+
{% endraw %}
407+
{% endhighlight %}
408+
{% highlight css tabtitle="App.css" %}
409+
{% raw %}
388410
.page {
389411
height: 100vh;
390412
display: grid;
@@ -398,7 +420,10 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
398420
background: #fff;
399421
border-bottom: 1px solid #e5e5e5;
400422
}
401-
```
423+
{% endraw %}
424+
{% endhighlight %}
425+
{% endtabs %}
426+
402427
![PDF Viewer in accordion](../images/react-layouts-accordion.png)
403428

404429
## Why visibility and height matter
@@ -412,12 +437,12 @@ The React PDF Viewer can be embedded into dashboards, admin panels, split‑scre
412437
- Short patterns:
413438
- Dispatch a global resize right after the container becomes visible:
414439

415-
```ts
440+
```js
416441
setTimeout(() => window.dispatchEvent(new Event('resize')), 0);
417442
```
418443
- Use a `ResizeObserver` when the host size may change frequently:
419444

420-
```ts
445+
```js
421446
const observer = new ResizeObserver(() => {
422447
window.dispatchEvent(new Event('resize'));
423448
});

Document-Processing/PDF/PDF-Viewer/react/theming-and-styling.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ The PDF Viewer applies styles to the toolbar, buttons, panels, annotations, and
2828
**Step-2:** To change the theme to tailwind, add the imports to tailwind theme in `app.css`.
2929

3030
```css
31-
@import '../node_modules/@syncfusion/ej2-base/styles/tailwind3.css';
32-
@import '../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css';
33-
@import '../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind3.css';
34-
@import '../node_modules/@syncfusion/ej2-inputs/styles/tailwind3.css';
35-
@import '../node_modules/@syncfusion/ej2-navigations/styles/tailwind3.css';
36-
@import '../node_modules/@syncfusion/ej2-popups/styles/tailwind3.css';
37-
@import '../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind3.css';
38-
@import "../node_modules/@syncfusion/ej2-pdfviewer/styles/tailwind3.css";
31+
@import '../node_modules/@syncfusion/ej2-base/styles/tailwind3.css';
32+
@import '../node_modules/@syncfusion/ej2-buttons/styles/tailwind3.css';
33+
@import '../node_modules/@syncfusion/ej2-dropdowns/styles/tailwind3.css';
34+
@import '../node_modules/@syncfusion/ej2-inputs/styles/tailwind3.css';
35+
@import '../node_modules/@syncfusion/ej2-navigations/styles/tailwind3.css';
36+
@import '../node_modules/@syncfusion/ej2-popups/styles/tailwind3.css';
37+
@import '../node_modules/@syncfusion/ej2-splitbuttons/styles/tailwind3.css';
38+
@import "../node_modules/@syncfusion/ej2-pdfviewer/styles/tailwind3.css";
3939
```
4040

4141
### Tutorial
@@ -78,8 +78,9 @@ Below is an approach that can be copied into the app that switches themes by dyn
7878

7979
**Link-swap approach:**
8080

81-
```ts
82-
// App.tsx
81+
{% tabs %}
82+
{% highlight ts tabtitle="App.tsx" %}
83+
{% raw %}
8384
type ThemeName = 'material3' | 'material3-dark';
8485
const THEME_LINK_ID = 'e-current-theme';
8586
function applyTheme(theme: ThemeName) {
@@ -127,7 +128,9 @@ export function App() {
127128
</div>
128129
</div>);
129130
}
130-
```
131+
{% endraw %}
132+
{% endhighlight %}
133+
{% endtabs %}
131134

132135
## Custom Styles
133136

@@ -143,8 +146,9 @@ While built-in themes provide a comprehensive look and feel, you might need to a
143146

144147
Apply overrides using a wrapper class so the rules are scoped and safe to maintain. The following example adds custom styles to signature form fields:
145148

146-
```css
147-
/* App.css */
149+
{% tabs %}
150+
{% highlight css tabtitle="App.css" %}
151+
{% raw %}
148152
/* This rule sets a scoped, custom black background for the PDF viewer page container */
149153
.e-custom-style .e-pv-page-container {
150154
background: #0b1220;
@@ -176,10 +180,10 @@ Apply overrides using a wrapper class so the rules are scoped and safe to mainta
176180
height: 100% !important;
177181
text-align: center !important;
178182
}
179-
```
180-
181-
```ts
182-
// src/App.tsx
183+
{% endraw %}
184+
{% endhighlight %}
185+
{% highlight ts tabtitle="App.tsx" %}
186+
{% raw %}
183187
import './App.css';
184188
import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, Print, TextSelection, Annotation, TextSearch, FormFields, FormDesigner, PageOrganizer, Inject } from '@syncfusion/ej2-react-pdfviewer';
185189

@@ -196,7 +200,9 @@ export function App() {
196200
</div>
197201
);
198202
}
199-
```
203+
{% endraw %}
204+
{% endhighlight %}
205+
{% endtabs %}
200206

201207
![Viewer background and signature fields example](images/styling-siganture-page-container.png)
202208

0 commit comments

Comments
 (0)