Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

Commit

Permalink
fix: allow copying locked note's title (#557)
Browse files Browse the repository at this point in the history
* fix: allow copying locked note's title

* chore: version bump
  • Loading branch information
vardan-arm committed Feb 24, 2022
1 parent 1a2b660 commit f6fa6ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "standardnotes-mobile",
"version": "3.12.0",
"user-version": "3.12.0",
"version": "3.12.1",
"user-version": "3.12.1",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
14 changes: 9 additions & 5 deletions src/screens/Compose/Compose.tsx
Expand Up @@ -3,6 +3,7 @@ import { ComponentLoadingError } from '@Lib/component_manager';
import { isNullOrUndefined } from '@Lib/utils';
import { ApplicationContext } from '@Root/ApplicationContext';
import { SCREEN_COMPOSE } from '@Screens/screens';
import SNTextView from '@standardnotes/react-native-textview';
import {
ApplicationEvent,
ComponentMutator,
Expand All @@ -21,7 +22,6 @@ import { lighten } from '@Style/utils';
import React, { createRef } from 'react';
import { Keyboard, Platform, View } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import SNTextView from '@standardnotes/react-native-textview';
import { ThemeContext } from 'styled-components';
import { ComponentView } from './ComponentView';
import {
Expand Down Expand Up @@ -53,6 +53,9 @@ type State = {
componentViewer?: ComponentViewer;
};

const EditingIsDisabledText =
'This note has editing disabled. Please enable editing on this note to make changes.';

export class Compose extends React.Component<{}, State> {
static contextType = ApplicationContext;
context: React.ContextType<typeof ApplicationContext>;
Expand Down Expand Up @@ -412,6 +415,10 @@ export class Compose extends React.Component<{}, State> {
};

onTitleChange = (newTitle: string) => {
if (this.note?.locked) {
this.context?.alertService?.alert(EditingIsDisabledText);
return;
}
this.setState(
{
title: newTitle,
Expand All @@ -422,9 +429,7 @@ export class Compose extends React.Component<{}, State> {

onContentChange = (text: string) => {
if (this.note?.locked) {
this.context?.alertService?.alert(
'This note has editing disabled. Please enable editing on this note to make changes.'
);
this.context?.alertService?.alert(EditingIsDisabledText);
return;
}
this.saveNote(false, true, false, false, text);
Expand Down Expand Up @@ -556,7 +561,6 @@ export class Compose extends React.Component<{}, State> {
keyboardAppearance={themeService?.keyboardColorForActiveTheme()}
autoCorrect={true}
autoCapitalize={'sentences'}
editable={!this.noteLocked}
/>
{(this.state.downloadingEditor ||
(this.state.loadingWebview &&
Expand Down

0 comments on commit f6fa6ce

Please sign in to comment.