Merge pull request #6483 from opf/fix/click-on-image-upload

[28137] Fix click on image upload

[ci skip]
pull/6484/head
Oliver Günther 6 years ago committed by GitHub
commit 7653a73a2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/assets/stylesheets/content/editor/_ckeditor.sass
  2. 1
      frontend/package.json
  3. 3
      frontend/src/app/components/wp-fast-table/handlers/row/click-handler.ts
  4. 30
      frontend/src/app/globals/global-listeners.ts
  5. 11
      frontend/src/app/init-globals.ts
  6. 4
      frontend/src/app/modules/fields/edit/editing-portal/edit-form-portal.component.html

@ -10,9 +10,15 @@
.op-ckeditor--wrapper
margin-bottom: 2rem
// Ensure same border and min-height for preview
.ck-content,
.ck-editor__preview
border: 1px solid var(--ck-color-base-border)
min-height: 100px
padding: 10px
// Specific overrides for ck contenteditable
.ck-content
min-height: 100px
// Code block
pre

@ -125,7 +125,6 @@
"serve": "ng serve",
"pretest": "./scripts/link_plugin_placeholder.js",
"test": "ng test",
"posttest": "npm run tslint_typechecks",
"tslint_typechecks": "./node_modules/.bin/tslint -p . -c tslint_typechecks.json",
"generate-typings": "tsc -d -p src/tsconfig.app.json",
"legacy-webpack": "./node_modules/.bin/webpack --colors --config legacy/webpack.config.js",

@ -19,9 +19,6 @@ export class RowClickHandler implements TableEventHandler {
public wpTableSelection:WorkPackageTableSelection = this.injector.get(WorkPackageTableSelection);
public wpTableFocus:WorkPackageTableFocusService = this.injector.get(WorkPackageTableFocusService);
private clicks = 0;
private timer:number;
constructor(public readonly injector:Injector,
table:WorkPackageTable) {
}

@ -35,20 +35,38 @@
// handled by Rails. As such, we disable the default link-hijacking that
// Angular's HTML5-mode turns on.
$(function() {
$(document.body)
.off('click')
$(document.documentElement)
// Prevent angular handling clicks on href="#..." links from other libraries
// (especially jquery-ui and its datepicker) from routing to <base url>/#
.on('click', 'a[href^="#"]', (evt) => {
evt.preventDefault();
.on('click', (evt) => {
const target = jQuery(evt.target);
// Avoid defaulting clicks on elements already removed from DOM
if (!document.contains(evt.target)) {
evt.preventDefault();
}
// Avoid handling clicks on anything other than a
const linkElement = target.closest('a');
if (linkElement.length === 0) {
return true;
}
const link = linkElement.attr('href') || '';
const hashPos = link.indexOf('#');
// If link is neither empty nor starts with hash, ignore it
if (link !== '' && hashPos === -1) {
return true;
}
// Set the location to the hash if there is any
// Since with the base tag, links like href="#whatever" otherwise target to <base>/#whatever
const link = evt.target.getAttribute('href');
if (link && link !== '#') {
if (hashPos !== -1 && link !== '#') {
window.location.hash = link;
}
evt.preventDefault();
return false;
});

@ -33,8 +33,15 @@ import {enableReactiveStatesLogging} from "reactivestates";
require('expose-loader?bowser!bowser');
// Global scripts previously part of the application.js
var requireGlobals = require.context('./globals/', true, /\.ts$/);
requireGlobals.keys().forEach(requireGlobals);
// Avoid require.context since that crashes angular regularly
require('./globals/augmenting/modal-wrapper.augment.service');
require('./globals/browser-specific-flags');
require('./globals/dynamic-bootstrapper');
require('./globals/global-listeners');
require('./globals/openproject');
require('./globals/top-shelf');
require('./globals/tree-menu');
require('./globals/unsupported-browsers');
window.appBasePath = jQuery('meta[name=app_base_path]').attr('content') || '';

@ -1,9 +1,7 @@
<div *ngIf="handler"
class="wp-inline-edit--active-field wp-edit-field inplace-edit {{ editField.name }}"
[ngClass]="{'-error': handler.isErrorenous }">
<form (click)="handler.stopPropagation($event)"
(dblclick)="handler.stopPropagation($event)"
(submit)="handler.handleUserSubmit()"
<form (submit)="handler.handleUserSubmit()"
role="form"
tabindex="-1">

Loading…
Cancel
Save