File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,11 @@ import { useRouter } from '../../lib/router'
2121import ColoredBlock from '../../../design/components/atoms/ColoredBlock'
2222import Editor from '../Editor'
2323import ApplicationPage from '../ApplicationPage'
24- import { freePlanDocLimit , freePlanMembersLimit } from '../../lib/subscription'
24+ import {
25+ freePlanDocLimit ,
26+ freePlanMembersLimit ,
27+ teamIsReadonly ,
28+ } from '../../lib/subscription'
2529import { useCloudDocPreview } from '../../lib/hooks/useCloudDocPreview'
2630
2731interface DocPageProps {
@@ -197,6 +201,7 @@ const DocPage = ({
197201 backLinks = { backLinks }
198202 revisionHistory = { revisionHistory }
199203 docIsEditable = { docIsEditable }
204+ readonly = { teamIsReadonly ( team , subscription ) }
200205 />
201206 )
202207}
Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ interface EditorProps {
116116 contributors : SerializedUser [ ]
117117 backLinks : SerializedDoc [ ]
118118 docIsEditable ?: boolean
119+ readonly ?: boolean
119120}
120121
121122interface EditorPosition {
@@ -143,6 +144,7 @@ const Editor = ({
143144 contributors,
144145 backLinks,
145146 docIsEditable,
147+ readonly = false ,
146148} : EditorProps ) => {
147149 const { translate } = useI18n ( )
148150 const {
@@ -258,6 +260,7 @@ const Editor = ({
258260
259261 return {
260262 mode : 'markdown' ,
263+ readOnly : readonly ,
261264 lineNumbers : showEditorLineNumbers ,
262265 lineWrapping : true ,
263266 theme,
@@ -281,7 +284,7 @@ const Editor = ({
281284 closeCharacters : / [ \s ( ) \[ \] { } ; : > , \n ] / ,
282285 } ,
283286 }
284- } , [ settings ] )
287+ } , [ settings , readonly ] )
285288
286289 const shortcodeConvertMenuStyle : React . CSSProperties = useMemo ( ( ) => {
287290 if ( shortcodeConvertMenu == null || editorRef . current == null ) {
Original file line number Diff line number Diff line change @@ -37,6 +37,17 @@ export function isTimeEligibleForDiscount(team: { createdAt: string }) {
3737 return false
3838}
3939
40+ export function teamIsReadonly (
41+ team : SerializedTeam ,
42+ subscription ?: SerializedSubscription
43+ ) {
44+ return (
45+ ( ( subscription == null || subscription . status === 'inactive' ) &&
46+ remainingTrialInfo ( team ) . remaining < 1 ) ||
47+ subscription != null
48+ )
49+ }
50+
4051export function remainingTrialInfo ( team : SerializedTeam ) {
4152 const createDate = new Date ( team . createdAt )
4253 const startDate = isBefore ( createDate , legacyCutoff )
You can’t perform that action at this time.
0 commit comments