mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
13 lines
329 B
CoffeeScript
13 lines
329 B
CoffeeScript
|
define [
|
||
|
"base"
|
||
|
], (App) ->
|
||
|
App.directive "validFile", () ->
|
||
|
return {
|
||
|
require: 'ngModel'
|
||
|
link: (scope, element, attrs, ngModelCtrl) ->
|
||
|
ngModelCtrl.$validators.validFile = (modelValue) ->
|
||
|
validFileRegex = /^[^\*\/]*$/ # Don't allow * and /
|
||
|
isValid = modelValue.match validFileRegex
|
||
|
return isValid
|
||
|
}
|