UNPKG

5.88 kBSource Map (JSON)View Raw
1{"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["memize","size","map","without","withSelect","EditorProvider","ErrorBoundary","PostLockedModal","StrictMode","Component","KeyboardShortcuts","preventEventDiscovery","Layout","Editor","arguments","getEditorSettings","maxSize","settings","hasFixedToolbar","focusMode","hiddenBlockTypes","blockTypes","defaultAllowedBlockTypes","allowedBlockTypes","props","post","initialEdits","onError","editorSettings","select","postId","postType","isFeatureActive","getPreference","getEntityRecord","getBlockTypes"],"mappings":";;;;;;;;;;;AAAA;;;AAGA,OAAOA,MAAP,MAAmB,QAAnB;AACA,SAASC,IAAT,EAAeC,GAAf,EAAoBC,OAApB,QAAmC,QAAnC;AAEA;;;;AAGA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,cAAT,EAAyBC,aAAzB,EAAwCC,eAAxC,QAA+D,mBAA/D;AACA,SAASC,UAAT,EAAqBC,SAArB,QAAsC,oBAAtC;AACA,SAASC,iBAAT,QAAkC,uBAAlC;AAEA;;;;AAGA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,OAAOC,MAAP,MAAmB,qBAAnB;;IAEMC,M;;;;;AACL,oBAAc;AAAA;;AAAA;;AACb,iFAAUC,SAAV;AAEA,UAAKC,iBAAL,GAAyBf,MAAM,CAAE,MAAKe,iBAAP,EAA0B;AACxDC,MAAAA,OAAO,EAAE;AAD+C,KAA1B,CAA/B;AAHa;AAMb;;;;sCAGAC,Q,EACAC,e,EACAC,S,EACAC,gB,EACAC,U,EACC;AACDJ,MAAAA,QAAQ,qBACJA,QADI;AAEPC,QAAAA,eAAe,EAAfA,eAFO;AAGPC,QAAAA,SAAS,EAATA;AAHO,QAAR,CADC,CAOD;;AACA,UAAKlB,IAAI,CAAEmB,gBAAF,CAAJ,GAA2B,CAAhC,EAAoC;AACnC;AACA;AACA;AACA,YAAME,wBAAwB,GAC7B,SAASL,QAAQ,CAACM,iBAAlB,GACCrB,GAAG,CAAEmB,UAAF,E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WACrCA,aADqC;;AAAA,iBAElCJ,MAAM,CAAE,MAAF,CAF4B;AAAA,MAEtDK,eAFsD,YAEtDA,eAFsD;;AAAA,iBAGpCL,MAAM,CAAE,aAAF,CAH8B;AAAA,MAGtDM,aAHsD,YAGtDA,aAHsD;;AAK9D,SAAO;AACNjB,IAAAA,eAAe,EAAEc,eAAe,CAAE,cAAF,CAD1B;AAENb,IAAAA,SAAS,EAAEa,eAAe,CAAE,WAAF,CAFpB;AAGNP,IAAAA,IAAI,EAAES,eAAe,CAAE,UAAF,EAAcH,QAAd,EAAwBD,MAAxB,CAHf;AAINV,IAAAA,gBAAgB,EAAEa,aAAa,CAAE,kBAAF,CAJzB;AAKNZ,IAAAA,UAAU,EAAEc,aAAa;AALnB,GAAP;AAOA,CAZwB,CAAV,CAYVtB,MAZU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { size, map, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { EditorProvider, ErrorBoundary, PostLockedModal } from '@wordpress/editor';\nimport { StrictMode, Component } from '@wordpress/element';\nimport { KeyboardShortcuts } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport preventEventDiscovery from './prevent-event-discovery';\nimport Layout from './components/layout';\n\nclass Editor extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.getEditorSettings = memize( this.getEditorSettings, {\n\t\t\tmaxSize: 1,\n\t\t} );\n\t}\n\n\tgetEditorSettings(\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t) {\n\t\tsettings = {\n\t\t\t...settings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( size( hiddenBlockTypes ) > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes = (\n\t\t\t\ttrue === settings.allowedBlockTypes ?\n\t\t\t\t\tmap( blockTypes, 'name' ) :\n\t\t\t\t\t( settings.allowedBlockTypes || [] )\n\t\t\t);\n\n\t\t\tsettings.allowedBlockTypes = without(\n\t\t\t\tdefaultAllowedBlockTypes,\n\t\t\t\t...hiddenBlockTypes,\n\t\t\t);\n\t\t}\n\n\t\treturn settings;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\tpost,\n\t\t\tinitialEdits,\n\t\t\tonError,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes,\n\t\t\t...props\n\t\t} = this.props;\n\n\t\tif ( ! post ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst editorSettings = this.getEditorSettings(\n\t\t\tsettings,\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thiddenBlockTypes,\n\t\t\tblockTypes,\n\t\t);\n\n\t\treturn (\n\t\t\t<StrictMode>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\tpost={ post }\n\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t<Layout />\n\t\t\t\t\t\t<KeyboardShortcuts shortcuts={ preventEventDiscovery } />\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t<PostLockedModal />\n\t\t\t\t</EditorProvider>\n\t\t\t</StrictMode>\n\t\t);\n\t}\n}\n\nexport default withSelect( ( select, { postId, postType } ) => {\n\tconst { isFeatureActive, getPreference } = select( 'core/edit-post' );\n\tconst { getEntityRecord } = select( 'core' );\n\tconst { getBlockTypes } = select( 'core/blocks' );\n\n\treturn {\n\t\thasFixedToolbar: isFeatureActive( 'fixedToolbar' ),\n\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\tpost: getEntityRecord( 'postType', postType, postId ),\n\t\thiddenBlockTypes: getPreference( 'hiddenBlockTypes' ),\n\t\tblockTypes: getBlockTypes(),\n\t};\n} )( Editor );\n"]}
\No newline at end of file