Skip to content

Commit

Permalink
⚡️ Update PdfJs.php to hide section containers instead of removing them
Browse files Browse the repository at this point in the history
  • Loading branch information
sugeng-sulistiyawan committed May 22, 2024
1 parent 77380b8 commit b885f88
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 4 deletions.
168 changes: 165 additions & 3 deletions src/PdfJs.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PdfJs extends Widget
public $options = [];

/**
* Show or hide section container
* Show or hide section container id
* Example:
*
* ```php
Expand All @@ -46,11 +46,173 @@ class PdfJs extends Widget
* ```
*
* This equivalent to:
* ```$('#{$sectionId}').remove();```;
* ```$('#{$sectionId}').hide();```;
*
* @var array
*/
public $sections = [];
public $sections = [
'outerContainer' => true,
'sidebarContainer' => true,
'toolbarSidebar' => true,
'toolbarSidebarLeft' => true,
'sidebarViewButtons' => true,
'viewThumbnail' => true,
'viewOutline' => true,
'viewAttachments' => true,
'viewLayers' => true,
'toolbarSidebarRight' => true,
'outlineOptionsContainer' => true,
'currentOutlineItem' => true,
'sidebarContent' => true,
'thumbnailView' => true,
'outlineView' => true,
'attachmentsView' => true,
'layersView' => true,
'sidebarResizer' => true,
'mainContainer' => true,
'findbar' => true,
'findbarInputContainer' => true,
'findInput' => true,
'findPrevious' => true,
'findNext' => true,
'findbarOptionsOneContainer' => true,
'findHighlightAll' => true,
'findMatchCase' => true,
'findbarOptionsTwoContainer' => true,
'findMatchDiacritics' => true,
'findEntireWord' => true,
'findbarMessageContainer' => true,
'findResultsCount' => true,
'findMsg' => true,
'editorHighlightParamsToolbar' => true,
'highlightParamsToolbarContainer' => true,
'editorHighlightColorPicker' => true,
'highlightColorPickerLabel' => true,
'editorHighlightThickness' => true,
'editorFreeHighlightThickness' => true,
'editorHighlightVisibility' => true,
'editorHighlightShowAll' => true,
'editorFreeTextParamsToolbar' => true,
'editorFreeTextColor' => true,
'editorFreeTextFontSize' => true,
'editorInkParamsToolbar' => true,
'editorInkColor' => true,
'editorInkThickness' => true,
'editorInkOpacity' => true,
'editorStampParamsToolbar' => true,
'editorStampAddImage' => true,
'secondaryToolbar' => true,
'secondaryToolbarButtonContainer' => true,
'secondaryOpenFile' => true,
'secondaryPrint' => true,
'secondaryDownload' => true,
'presentationMode' => true,
'viewBookmark' => true,
'viewBookmarkSeparator' => true,
'firstPage' => true,
'lastPage' => true,
'pageRotateCw' => true,
'pageRotateCcw' => true,
'cursorToolButtons' => true,
'cursorSelectTool' => true,
'cursorHandTool' => true,
'scrollModeButtons' => true,
'scrollPage' => true,
'scrollVertical' => true,
'scrollHorizontal' => true,
'scrollWrapped' => true,
'spreadModeButtons' => true,
'spreadNone' => true,
'spreadOdd' => true,
'spreadEven' => true,
'documentProperties' => true,
'toolbarContainer' => true,
'toolbarViewer' => true,
'toolbarViewerLeft' => true,
'sidebarToggle' => true,
'viewFind' => true,
'previous' => true,
'next' => true,
'pageNumber' => true,
'numPages' => true,
'toolbarViewerRight' => true,
'editorModeButtons' => true,
'editorHighlight' => true,
'editorFreeText' => true,
'editorInk' => true,
'editorStamp' => true,
'editorModeSeparator' => true,
'print' => true,
'download' => true,
'secondaryToolbarToggle' => true,
'toolbarViewerMiddle' => true,
'zoomOut' => true,
'zoomIn' => true,
'scaleSelectContainer' => true,
'scaleSelect' => true,
'pageAutoOption' => true,
'pageActualOption' => true,
'pageFitOption' => true,
'pageWidthOption' => true,
'customScaleOption' => true,
'loadingBar' => true,
'viewerContainer' => true,
'viewer' => true,
'dialogContainer' => true,
'passwordDialog' => true,
'passwordText' => true,
'password' => true,
'passwordCancel' => true,
'passwordSubmit' => true,
'documentPropertiesDialog' => true,
'fileNameLabel' => true,
'fileNameField' => true,
'fileSizeLabel' => true,
'fileSizeField' => true,
'titleLabel' => true,
'titleField' => true,
'authorLabel' => true,
'authorField' => true,
'subjectLabel' => true,
'subjectField' => true,
'keywordsLabel' => true,
'keywordsField' => true,
'creationDateLabel' => true,
'creationDateField' => true,
'modificationDateLabel' => true,
'modificationDateField' => true,
'creatorLabel' => true,
'creatorField' => true,
'producerLabel' => true,
'producerField' => true,
'versionLabel' => true,
'versionField' => true,
'pageCountLabel' => true,
'pageCountField' => true,
'pageSizeLabel' => true,
'pageSizeField' => true,
'linearizedLabel' => true,
'linearizedField' => true,
'documentPropertiesClose' => true,
'altTextDialog' => true,
'altTextContainer' => true,
'overallDescription' => true,
'dialogLabel' => true,
'dialogDescription' => true,
'addDescription' => true,
'descriptionButton' => true,
'descriptionAreaLabel' => true,
'descriptionTextarea' => true,
'markAsDecorative' => true,
'decorativeButton' => true,
'decorativeLabel' => true,
'buttons' => true,
'altTextCancel' => true,
'altTextSave' => true,
'printServiceDialog' => true,
'printCancel' => true,
'printContainer' => true,
];

/**
* @return Module
Expand Down
2 changes: 1 addition & 1 deletion src/views/default/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$js = '';
foreach ($sections as $section => $show) {
if (!$show) {
$js .= "$('#{$section}').remove();";
$js .= "$('#{$section}').hide();";
}
}

Expand Down

0 comments on commit b885f88

Please sign in to comment.