0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-28 17:13:31 +01:00
wagtail/client/tests/stubs.js

102 lines
3.1 KiB
JavaScript
Raw Normal View History

/**
* Test stubs to mirror available global variables.
* Those variables usually come from the back-end via templates.
* See /wagtailadmin/templates/wagtailadmin/admin_base.html.
*/
import 'element-closest';
global.wagtailConfig = {
ADMIN_API: {
2019-11-05 12:39:48 +01:00
DOCUMENTS: '/admin/api/main/documents/',
IMAGES: '/admin/api/main/images/',
PAGES: '/admin/api/main/pages/',
EXTRA_CHILDREN_PARAMETERS: '',
},
ADMIN_URLS: {
PAGES: '/admin/pages/',
},
DATE_FORMATTING: {
DATE_FORMAT: 'MMM. D, YYYY',
SHORT_DATE_FORMAT: 'DD/MM/YYYY',
},
STRINGS: {
DELETE: 'Delete',
EDIT: 'Edit',
PAGE: 'Page',
PAGES: 'Pages',
2018-01-26 15:04:15 +01:00
LOADING: 'Loading…',
NO_RESULTS: 'No results',
SERVER_ERROR: 'Server Error',
SEE_ALL: 'See all',
CLOSE_EXPLORER: 'Close explorer',
ALT_TEXT: 'Alt text',
DECORATIVE_IMAGE: 'Decorative image',
WRITE_HERE: 'Write here…',
HORIZONTAL_LINE: 'Horizontal line',
LINE_BREAK: 'Line break',
UNDO: 'Undo',
REDO: 'Redo',
2018-02-27 16:34:22 +01:00
RELOAD_PAGE: 'Reload the page',
RELOAD_EDITOR: 'Reload saved content',
2018-02-27 16:34:22 +01:00
SHOW_LATEST_CONTENT: 'Show latest content',
SHOW_ERROR: 'Show error',
2018-02-27 16:34:22 +01:00
EDITOR_CRASH: 'The editor just crashed. Content has been reset to the last saved version.',
BROKEN_LINK: 'Broken link',
MISSING_DOCUMENT: 'Missing document',
CLOSE: 'Close',
EDIT_PAGE: 'Edit \'{title}\'',
VIEW_CHILD_PAGES_OF_PAGE: 'View child pages of \'{title}\'',
PAGE_EXPLORER: 'Page explorer',
SAVE: 'Save',
SAVING: 'Saving...',
CANCEL: 'Cancel',
DELETING: 'Deleting...',
Feature/redux comments (#6856) Adds inline commenting to the Draftail editor (FE only), and refactors field level comments to subscribe to updates from the store directly * Refactor field level comments to subscribe to updates directly from the commenting store, rather than calling methods on supplied widgets and annotations directly from the commenting app * Update Draftail and React-Redux packages in preparation for Draftail inline commenting * Add CommentableEditor version of Draftail as controlled component, in preparation for manipulating state from the comments system * Only initialize CommentableEditor if comments are on and the contentpath is valid. Add a comment-adding control to CommentableEditor * Update eslint * Remove comment adding control from Draftail if comments are disabled * fixup! Only initialize CommentableEditor if comments are on and the contentpath is valid. Add a comment-adding control to CommentableEditor * Add decorator to comments, allowing them to be focused * Add inline styling to comments * Make Draftail instance accessible via the DOM node on CommentableEditor as well * Force rerender for styles and decorators when necessary, and filter out deleted comments * Remove comment styles when saving Draftail content * Fix formatting error * Remove unnecessary comment * Don't use addition for string concatenation * Newline * Add explanatory comment about save logic * fixup! Don't use addition for string concatenation * Use more idiomatic undefined check * Fix aria-label for comment button * Use span to decorate link Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com> * Update getFullSelectionState comment Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com> * Reorder selection state generation Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com> * Remove unused argument Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com> * Make draftail position comments by median annotation, and pin by clicked comment * Remove inline return * Make setPinnedComment an option on setFocusedComment * Add JSDoc comments and remove unused attribute * use decoratorRef instead of Ref for clarity in annotation * fixup! Update eslint * Update Draftail snapshot * Move entrypoint * Prettier reformat and eslint fix * Use Typescript for CommentableEditor * Install types for react-redux and draft-js * Remove unused popPage from interface * Add draftjs-filters as an explicit dependency * fixup! Use Typescript for CommentableEditor * Add explicit type for timeout Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
2021-03-25 10:56:27 +01:00
ADD_A_COMMENT: 'Add a comment',
SHOW_COMMENTS: 'Show comments',
REPLY: 'Reply',
2020-12-03 13:11:07 +01:00
RESOLVE: 'Resolve',
RETRY: 'Retry',
DELETE_ERROR: 'Delete error',
CONFIRM_DELETE_COMMENT: 'Are you sure?',
SAVE_ERROR: 'Save error',
SAVE_COMMENT_WARNING: 'This will be saved when the page is saved',
FOCUS_COMMENT: 'Focus comment',
UNFOCUS_COMMENT: 'Unfocus comment',
SAVE_PAGE_TO_ADD_COMMENT: 'Save the page to add this comment',
SAVE_PAGE_TO_SAVE_COMMENT_CHANGES: 'Save the page to save this comment',
SAVE_PAGE_TO_SAVE_REPLY: 'Save the page to save this reply',
},
WAGTAIL_I18N_ENABLED: true,
LOCALES: [
{
code: 'en',
display_name: 'English'
},
{
code: 'fr',
display_nam: 'French'
}
],
ACTIVE_LOCALE: 'en'
};
global.wagtailVersion = '1.6a1';
global.wagtail = {};
global.chooserUrls = {
documentChooser: '/admin/documents/chooser/',
emailLinkChooser: '/admin/choose-email-link/',
anchorLinkChooser: '/admin/choose-anchor-link',
embedsChooser: '/admin/embeds/chooser/',
externalLinkChooser: '/admin/choose-external-link/',
imageChooser: '/admin/images/chooser/',
pageChooser: '/admin/choose-page/',
};
/* use dummy content for onload handlers just so that we can verify that we've chosen the right one */
global.IMAGE_CHOOSER_MODAL_ONLOAD_HANDLERS = { type: 'image' };
global.PAGE_CHOOSER_MODAL_ONLOAD_HANDLERS = { type: 'page' };
global.EMBED_CHOOSER_MODAL_ONLOAD_HANDLERS = { type: 'embed' };
global.DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS = { type: 'document' };